from collections import defaultdict as dd n = int(input()) G = [ [] for _ in range(n+1) ] deg = dd(lambda:0) for _ in range(n-1): u,v = map(int, input().split()) G[u].append(v) G[v].append(u) deg[u] += 1 deg[v] += 1 for v in range(1, n+1): ans = -deg[v] for u in G[v]: ans += deg[u] print(ans)