import sys from sklearn.utils import resample sys.setrecursionlimit(10**8) N = int(input()) G = [list() for _ in range(N)] for i in range(N-1): a, b = map(int, input().split()) a-=1;b-=1 G[a].append(b) G[b].append(a) sub_tree = [0]*N def dfs(v,p): for next_v in G[v]: if next_v == p: continue dfs(next_v, v) sub_tree[v] = 1 for c in G[v]: if c== p: continue sub_tree[v] += sub_tree[c] def count(v,p,sm): for nex in G[v]: if nex==p:continue v1, v2 = sub_tree[v], sub_tree[nex] sm += v1-2*v2 sub_tree[v] = v1-v2 sub_tree[nex] = v1 global res res += sm count(nex,v,sm) sub_tree[v] = v1 sub_tree[nex] = v2 sm -= v1-2*v2 dfs(0,-1) res = sum(sub_tree) count(0,-1,sum(sub_tree)) print(res)