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