#include <bits/stdc++.h>
using namespace std;
int deg[10000 + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    deg[a - 1]++, deg[b - 1]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += deg[i] * (deg[i] - 1) / 2;
  cout << ans;
}
