#include <bits/stdc++.h>
using namespace std;
int n, i, x, y;
long long ans;
int d[11555];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    d[x]++;
    d[y]++;
  }
  for (int i = 1; i <= n; i++) {
    ans += (d[i] * (d[i] - 1)) / 2;
  }
  printf("%lld\n", ans);
  return 0;
}
