n=int(input()) ans=0 deg=[0]*n for i in range(n-1): a,b=map(int,input().split()) deg[a-1]+=1 deg[b-1]+=1 for i in range(n): ans+=max(0,deg[i]-2) print(ans)