from collections import deque from collections import defaultdict as dd n = int(input()) G = [ [] for _ in range(n+1) ] for _ in range(n-1): u,v = map(int, input().split()) G[u].append(v) G[v].append(u) def bfs(start): dist = [-1] * (n+1) dist[start] = 0 que = deque() que.append(start) cnt = 0 while que: v = que.popleft() for v2 in G[v]: if dist[v2] != -1: continue dist[v2] = dist[v] + 1 if dist[v2] == 2: cnt += 1 if dist[v2] > 2: return cnt que.append(v2) return cnt for i in range(1, n+1): ans = bfs(i) print(ans)