#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 10;
int n, cnt[maxn], ans;
int main() {
  cin >> n;
  for (int i = 1, v, u; i < n; ++i) {
    cin >> v >> u;
    ++cnt[v];
    ++cnt[u];
  }
  for (int i = 1; i <= n; ++i) ans += cnt[i] * (cnt[i] - 1) / 2;
  cout << ans << '\n';
  return 0;
}
