n = int(input()) edges = [[] for _ in range(n)] for _ in range(n - 1): u, v = map(int, input().split()) u -= 1 v -= 1 edges[u].append(v) edges[v].append(u) for i in range(n): ans = 0 for u in edges[i]: ans += len(edges[u]) - 1 print(ans)