#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  cin >> n;
  pair<int, int> p[n];
  for (int i = 0; i < n - 1; i++) {
    cin >> p[i].first >> p[i].second;
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (p[i].second == p[j].first || p[i].first == p[j].first ||
          p[i].first == p[j].second || p[i].second == p[j].second)
        cnt++;
    }
  }
  cout << cnt << endl;
}
