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