#include <bits/stdc++.h>
using namespace std;
int a[12001], p[12001], n, i, one, two, ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    cin >> one >> two;
    p[one]++;
    p[two]++;
  }
  for (i = 1; i <= n; i++) ans += p[i] * (p[i] - 1) / 2;
  cout << ans << '\n';
  return 0;
}
