import sys input = lambda :sys.stdin.readline()[:-1] from collections import deque, Counter, defaultdict def main(): N = int(input()) graph = [[] for _ in range(N)] for _ in range(N-1): a, b = map(lambda x: int(x) - 1, input().split()) graph[a].append(b) graph[b].append(a) # 有向グラフなら消す # print(graph) def bfs(s): d = deque() d.append(s) dist = [-1] * N dist[s] = 0 while d: v = d.popleft() for i in graph[v]: if dist[i] != -1: continue dist[i] = dist[v] + 1 if dist[i] >= 3: break d.append(i) else: continue break return dist.count(2) for i in range(N): print(bfs(i)) if __name__ == '__main__': main()