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