#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10006;
int dushu[MAXN] = {0};
int n;
int main() {
  int tmp1, tmp2;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    scanf("%d%d", &tmp1, &tmp2);
    ++dushu[tmp1];
    ++dushu[tmp2];
  }
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    if (dushu[i] >= 2) sum += (dushu[i]) * (dushu[i] - 1) / 2;
  }
  cout << sum << endl;
  return 0;
}
