#include <bits/stdc++.h>
const int INF = 2147483647;
const int MOD = 1000000007;
const long long INF64 = 9223372036854775807;
const long double EPS = 1e-7;
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[n], f, t;
  for (int i = 0; i < n; i++) a[i] = 0;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &f, &t);
    a[--f]++;
    a[--t]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += 1ll * a[i] * (a[i] - 1) / 2;
  printf("%I64d\n", ans);
  return 0;
}
