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;
class UnionFind {
 private:
 public:
  vector<int> p, rank, setSize, minn;
  int numSets;
  UnionFind(int N) {
    setSize.assign(N, 1);
    numSets = N;
    rank.assign(N, 0);
    p.assign(N, 0);
    minn.resize(N);
    for (int i = 0; i < N; i++) {
      p[i] = i;
      minn[i] = i;
    }
  }
  int findSet(int i) {
    if (p[i] == i)
      return i;
    else {
      p[i] = findSet(p[i]);
      minn[p[i]] = min(minn[p[i]], i);
      return p[i];
    }
  }
  bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
  void unionSet(int i, int j) {
    if (!isSameSet(i, j)) {
      numSets--;
      int x = findSet(i), y = findSet(j);
      if (rank[x] > rank[y]) {
        p[y] = x;
        setSize[x] += setSize[y];
        minn[x] = min(minn[x], minn[y]);
      } else {
        p[x] = y;
        setSize[y] += setSize[x];
        minn[y] = min(minn[x], minn[y]);
        if (rank[x] == rank[y]) rank[y]++;
      }
    }
  }
  int numDisjointSets() { return numSets; }
  int sizeOfSet(int i) { return setSize[findSet(i)]; }
};
class fenwick_tree {
  vector<long> t;
  long size;

 public:
  fenwick_tree(long n) {
    t.assign(n + 1, 0);
    size = n + 1;
  }
  long LSOne(long k) { return k & (-k); }
  void update(long index, long val) {
    for (; index < size; index += LSOne(index)) t[index] += val;
  }
  long query_full(long a, long b) {
    return query(b) - ((a <= 1) ? 0 : query(a - 1));
  }
  long query(long b) {
    if (b < 1) return 0;
    long sum = 0;
    for (; b; b -= LSOne(b)) sum += t[b];
    return sum;
  }
};
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
int prime[11050000];
int lp[32001002];
class prime_class {
 public:
  long top;
  prime_class() {
    int i, i2, j;
    top = 0;
    lp[0] = 0;
    lp[1] = 1;
    for (i = 2; i < 32001002; i++) lp[i] = 0;
    top = 0;
    for (i = 2; i < 32001002; ++i) {
      if (lp[i] == 0) {
        lp[i] = i;
        prime[top++] = i;
      }
      for (j = 0; (j < top) && (prime[j] <= lp[i]) && (i * prime[j] < 32001002);
           ++j)
        lp[i * prime[j]] = prime[j];
    }
  }
  bool isprime(int key) {
    if (key < 32001002)
      return (lp[key] == key) && (key >= 2);
    else {
      int i;
      for (i = 0; (i < top) && (prime[i] * prime[i] <= key); i++)
        if (key % prime[i] == 0) return false;
      return true;
    }
  }
  unordered_map<int, int> factorize(int key) {
    unordered_map<int, int> ans;
    while (lp[key] != key) {
      ans[lp[key]]++;
      key /= lp[key];
    }
    if (key > 1) ans[key]++;
    return ans;
  }
  vector<pair<long long, long long>> factorize_full(long long key) {
    vector<pair<long long, long long>> ans;
    long i, ct;
    for (i = 0; (i < top) && (prime[i] <= key); i++)
      if (key % prime[i] == 0) {
        ct = 0;
        while (key % prime[i] == 0) {
          ct++;
          key /= prime[i];
        }
        ans.push_back({prime[i], ct});
      }
    if (key > 1) {
      ans.push_back({key, 1});
    }
    return ans;
  }
  void generate_divisors(int step, int v, vector<pair<int, int>>& fp,
                         vector<int>& ans) {
    if (step < fp.size()) {
      generate_divisors(step + 1, v, fp, ans);
      for (int i = 1; i <= fp[step].second; i++) {
        v *= fp[step].first;
        generate_divisors(step + 1, v, fp, ans);
      }
    } else
      ans.push_back(v);
  }
  void generate_divisors_full(long long step, long long v,
                              vector<pair<long long, long long>>& fp,
                              vector<long long>& ans) {
    if (step < fp.size()) {
      generate_divisors_full(step + 1, v, fp, ans);
      for (int i = 1; i <= fp[step].second; i++) {
        v *= fp[step].first;
        generate_divisors_full(step + 1, v, fp, ans);
      }
    } else
      ans.push_back(v);
  }
  vector<int> get_divisors(int key) {
    unordered_map<int, int> f = factorize(key);
    int n = f.size();
    vector<pair<int, int>> fp;
    for (auto p : f) fp.push_back(p);
    vector<int> ans;
    generate_divisors(0, 1, fp, ans);
    return ans;
  }
  vector<long long> get_divisors_full(long long key) {
    vector<pair<long long, long long>> f = factorize_full(key);
    int n = f.size();
    vector<pair<long long, long long>> fp;
    for (auto p : f) fp.push_back(p);
    vector<long long> ans;
    generate_divisors_full(0, 1, fp, ans);
    return ans;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, k, a, b, ans;
  cin >> n;
  vector<long long> adj(n + 1, 0);
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    adj[a]++;
    adj[b]++;
  }
  ans = 0;
  for (i = 1; i <= n; i++) ans += (adj[i] * (adj[i] - 1)) / 2;
  cout << ans << "\n";
  return 0;
}
