N=int(input()) D=[0]*(N+1) for i in range(N-1): a,b=map(int,input().split()) D[a]+=1 D[b]+=1 S=0 for d in D[1:]: S+=max(0,d-2) print(S)