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;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
string sum(string a, string b) {
  string ans = "";
  for (long long i = 0; i <= max((int((a.size()))), (int((b.size())))); i++)
    ans += '0';
  reverse((a).begin(), (a).end());
  reverse((b).begin(), (b).end());
  while ((int((a.size()))) > (int((b.size())))) b += '0';
  while ((int((a.size()))) < (int((b.size())))) a += '0';
  for (long long i = 0; i <= (int((a.size()))) - 1; i++) {
    int temp = int(ans[i] - '0');
    temp += (a[i] - '0');
    temp += (b[i] - '0');
    int j = 0;
    while (temp > 0) {
      ans[i + j] = char((temp % 10) + '0');
      temp /= 10;
      j++;
    }
  }
  reverse((ans).begin(), (ans).end());
  while (ans[0] == '0' && (int((ans.size()))) > 1) ans.erase(0, 1);
  return ans;
}
bool prime(long long x) {
  if (x == 0) return 1;
  if (x == 1) return 0;
  for (long long i = 2; i <= sqrt(x); i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
bool palindrom(string s) {
  string ss = s;
  reverse((ss).begin(), (ss).end());
  return ss == s;
}
vector<int> g[11111];
set<pair<int, int> > s;
set<int> used;
void dfs(int x, int ss, int z = 0) {
  used.insert(x);
  if (z == 2 && x != ss) {
    s.insert(make_pair(min(x, ss), max(x, ss)));
    return;
  }
  for (auto i : g[x]) {
    if (used.count(i) == 0) dfs(i, ss, z + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (!1) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int n;
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (long long i = 1; i <= n; i++) {
    used.clear();
    dfs(i, i);
  }
  cout << (int((s.size())));
  return 0;
}
