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