#include <bits/stdc++.h>
using namespace std;
int ar[100000];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    ar[a]++;
    ar[b]++;
  }
  long long sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += (ar[i] * (ar[i] - 1) / 2);
  }
  cout << sum << endl;
  return 0;
}
