import sys sys.setrecursionlimit(10**9) N=int(input()) G=[[] for _ in range(N)] for _ in range(N-1): a,b=map(lambda x:int(x)-1,input().split()) G[a].append(b) G[b].append(a) subtree_size=[1]*N subtree_size_of_childlen=[[] for _ in range(N)] def dfs(G,v,p=-1): for nextv in G[v]: if nextv!=p: dfs(G,nextv,v) for c in G[v]: if c!=p: subtree_size[v]+=subtree_size[c] def dfs2(G,v,p=-1): for nextv in G[v]: if nextv!=p: dfs2(G,nextv,v) for c in G[v]: if c!=p: subtree_size_of_childlen[v].append(subtree_size[c]) dfs(G,0) dfs2(G,0) ans=0 for i in range(N): # print(i) ans+=(N-subtree_size[i])*subtree_size[i] # print(ans) for num in subtree_size_of_childlen[i]: ans+=(N-num)*num # print(ans) print(ans+N*N)