#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n;
  while (cin >> n) {
    int ans = 0;
    for (int i = 1; i < n; i++) {
      int x, y;
      cin >> x >> y;
      ans += a[x] + a[y];
      a[x]++, a[y]++;
    }
    cout << ans << endl;
  }
  return 0;
}
