# 木、閉路なし、ということはdegreeだけで計算できるか N = int(input()) edges = [[] for i in range(N+1)] degree = [0]*(N+1) for i in range(N-1): u, v = map(int, input().split()) edges[u].append(v) edges[v].append(u) degree[u] += 1 degree[v] += 1 for i in range(1, N+1): count = 0 for nxt in edges[i]: count += max(0, degree[nxt]-1) print(count)