import sys sys.setrecursionlimit(500000) N=int(input()) edge=[[] for _ in range(N)] for _ in range(N-1): a,b=map(int,input().split()) a-=1 b-=1 edge[a].append(b) edge[b].append(a) used=[0]*N total=0 def dfs(i): global total used[i]=1 dp=[0,0,0] c=[0,0,0] for np in edge[i]: if used[np]==1: continue d=dfs(np) total+=d[0]*c[0]+d[0]*c[1]+d[1]*c[0] for j in range(3): c[j]+=d[j] total+=c[0]+c[1]+c[2] dp[0]=1 dp[1]=c[0] dp[2]=c[1] return dp dfs(0) print(total)