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 long long INF = 1000000000 + 7;
const double esp = 1e-13;
const long double PI = acos(-1.0);
long long nhan(long long x, long long y, long long m) {
  long long ans = 0;
  while (y) {
    if (y % 2) ans = (ans + x) % m;
    x = x * 2 % m;
    y /= 2;
  }
  return ans;
}
long long power(long long a, long long n, long long m) {
  unsigned long long ans = 1;
  while (n) {
    if (n % 2) ans = ans * a % m;
    a = a * a % m;
    n /= 2;
  }
  return ans;
}
bool check(long long n) {
  if (n == 2) return true;
  if (n < 2 || n % 2 == 0) return false;
  long long p[3] = {3, 5, 7};
  long long a, d;
  int r, s;
  d = n - 1;
  s = 0;
  while (d % 2 == 0) {
    d /= 2;
    s++;
  }
  for (long long i = 0; i <= 2; i++) {
    if (n == p[i]) return true;
    if (n % p[i] == 0) return false;
    a = power(p[i], d, n);
    if (a != 1) {
      for (r = 0; r < s && a != n - 1; r++) a = a * a % n;
      if (r == s) return false;
    }
  }
  return true;
}
long long phi(long long n) {
  long long ans = n;
  long long n2 = (long long)sqrt(n);
  for (long long i = 2; i <= n2; i++)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      ans -= ans / i;
    }
  if (n > 1) ans -= ans / n;
  return ans;
}
int n, x, y, a[10000 + 10];
;
long long ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    a[x]++;
    a[y]++;
  }
  for (long long i = 1; i <= n; i++) ans += a[i] * (a[i] - 1) / 2;
  cout << ans;
}
