#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int n, d[N];
int main() {
  int x, y;
  while (~scanf("%d", &n)) {
    memset(d, 0, sizeof(d));
    for (int i = 1; i < n; i++) {
      scanf("%d %d", &x, &y);
      d[x]++;
      d[y]++;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (d[i] >= 2) {
        ans = ans + d[i] * (d[i] - 1) / 2;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
