#include <bits/stdc++.h>
using namespace std;
vector<int> way[10005];
int main() {
  int n;
  long long res = 0;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    way[u].push_back(v);
    way[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    res += way[i].size() * (way[i].size() - 1) / 2;
  }
  printf("%I64d", res);
  return 0;
}
