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