N=int(input()) degs=[0 for _ in range(N)] UV=[] for _ in range(N-1): u,v=map(int,input().split()) u-=1 v-=1 UV.append((u,v)) degs[u]+=1 degs[v]+=1 ans=N-1 for i in range(N): ans+=degs[i]*(degs[i]-1)//2 for (u,v) in UV: ans+=(degs[u]-1)*(degs[v]-1) print(ans)