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