N=int(input()) graph=[[] for x in range(N)] for i in range(N-1): u,v=map(int,input().split()) u-=1;v-=1 graph[u].append(v) graph[v].append(u) for x in range(N): ans=sum(len(graph[y])-1 for y in graph[x]) print(ans)