Heidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.

On the surface, the Tree of Life is just a regular undirected tree well-known from computer science. This means that it is a collection of n points (called vertices), some of which are connected using n - 1 line segments (edges) so that each pair of vertices is connected by a path (a sequence of one or more edges).

To decipher the prophecy, Heidi needs to perform a number of steps. The first is counting the number of lifelines in the tree – these are paths of length 2, i.e., consisting of two edges. Help her!

Input

The first line of the input contains a single integer n – the number of vertices in the tree (1 ≤ n ≤ 10000). The vertices are labeled with the numbers from 1 to n. Then n - 1 lines follow, each describing one edge using two space-separated numbers a b – the labels of the vertices connected by the edge (1 ≤ a < b ≤ n). It is guaranteed that the input represents a tree.

Output

Print one integer – the number of lifelines in the tree.

Examples

Input

4
1 2
1 3
1 4


Output

3

Input

5
1 2
2 3
3 4
3 5


Output

4

Note

In the second sample, there are four lifelines: paths between vertices 1 and 3, 2 and 4, 2 and 5, and 4 and 5.
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int INF = 0x3f3f3f3f;
int nex[301010];
int to[301010];
int begi[301010];
int weight[301010];
int e;
int vis[301010];
void add(int x, int y) {
  nex[++e] = begi[x];
  begi[x] = e;
  to[e] = y;
}
void init(int n) {
  e = 0;
  memset(begi, -1, sizeof(begi));
  memset(to, -1, sizeof(to));
  memset(nex, -1, sizeof(nex));
}
int ans;
void search(int now) {
  memset(vis, -1, sizeof(vis));
  memset(weight, 0, sizeof(weight));
  vis[now] = 1;
  queue<int> q;
  q.push(now);
  while (!q.empty()) {
    int tem = q.front();
    q.pop();
    int temp = begi[tem];
    while (temp != -1) {
      if (vis[to[temp]] != 1) {
        vis[to[temp]] = 1;
        weight[to[temp]] = weight[tem] + 1;
        if (weight[to[temp]] == 2)
          ans++;
        else
          q.push(to[temp]);
      }
      temp = nex[temp];
    }
  }
  return;
}
void print(int n) {
  for (int i = 1; i <= n; i++) cout << i << " " << weight[i] << endl;
  cout << endl;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  int n, v;
  while (cin >> v) {
    init(v);
    int st, ed;
    for (int i = 1; i < v; i++) {
      cin >> st >> ed;
      add(st, ed);
      add(ed, st);
    }
    ans = 0;
    for (int i = 1; i <= v; i++) {
      search(i);
    }
    cout << ans / 2 << endl;
  }
  return 0;
}
