#include <bits/stdc++.h>
using namespace std;
vector<int> graph[10002];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    int sz = graph[i].size();
    cnt = cnt + (long long)(sz * (sz - 1)) / 2;
  }
  printf("%I64d", cnt);
}
