N = int(input()) con = [set() for i in range(N)] for i in range(N - 1): A = list(map(int, input().split())) for j in range(2): con[A[j] - 1].add(A[1 - j] - 1) for i in range(N): ans = 0 for j in con[i]: ans += len(con[j]) - 1 print(ans)