#include <bits/stdc++.h>
using namespace std;
const int MaxN = 10010;
int n, deg[MaxN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ++deg[u];
    ++deg[v];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += 1ll * deg[i] * (deg[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
