##N,K=map(int, input().split()) #A=list(map(int, input().split())) N=int(input()) D=[[]for _ in range(N)] E=[set() for _ in range(N)] for i in range(N-1): u,v=map(int, input().split()) u-=1;v-=1 D[u].append(v);D[v].append(u) E[u].add(v);E[v].add(u) ans=[] for i in range(N): C=set() for now in D[i]: for nex in D[now]: C.add(nex) print(len(C)-1)