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