#include <bits/stdc++.h>
using namespace std;
vector<int> son[10010];
long long cnt[10010];
int main(int argc, char const *argv[]) {
  memset(cnt, 0, sizeof(cnt));
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) son[i].clear();
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    son[u].push_back(v);
    son[v].push_back(u);
    cnt[u]++;
    cnt[v]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = ans + cnt[i] * (cnt[i] - 1) / 2;
  printf("%I64d\n", ans);
  return 0;
}
