N = int(input()) G = [[] for _ in range(N)] Gnum = [0] * N for _ in range(N - 1): u,v = map(int,input().split()) u -= 1 v -= 1 Gnum[u] += 1 Gnum[v] += 1 G[u].append(v) G[v].append(u) for i in range(N): ans = 0 for u in G[i]: ans += Gnum[u] - 1 print(ans)