#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
  static char c;
  static int f;
  for (c = getchar(), f = 1; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (x = 0; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c & 15);
  x *= f;
}
template <typename T>
void write(T x) {
  static char q[65];
  int cnt = 0;
  if (x < 0) putchar('-'), x = -x;
  q[++cnt] = x % 10, x /= 10;
  while (x) q[++cnt] = x % 10, x /= 10;
  while (cnt) putchar(q[cnt--] + '0');
}
const int maxn = 10004;
int d[maxn];
int main() {
  int n;
  read(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u), read(v);
    ++d[u], ++d[v];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += 1ll * d[i] * (d[i] - 1) / 2;
  write(ans), putchar('\n');
  return 0;
}
