N=int(input()) D=[[] for i in range(N)] for i in range(N-1): x,y=map(int, input().split()) x-=1;y-=1 D[x].append(y) D[y].append(x) ans=N-1 from collections import deque d=deque() V=[-1]*N V[0]=0 d.append(0) G=[[] for i in range(N)] P=[-1]*N while d: now=d.popleft() for nex in D[now]: if V[nex]==-1: G[now].append(nex) V[nex]=V[now]+1 P[nex]=now d.append(nex) DD={} for v in V: if v not in DD: DD[v]=0 DD[v]+=1 for i in range(N): g=len(G[i]) if i!=0: ans+=g ans+=g*(g-1)//2 if V[i]>=2: c=P[P[i]] ans+=len(G[c])-1 if V[i]>=3: ans+=1 print(ans)