import sys readline = sys.stdin.readline def non_rec_dfs(s): stack = [] stack.append(s) par = [-1] * N sz = [1] * N global ans while stack: u = stack.pop() if u >= 0: stack.append(~u) for v in G[u]: if v == par[u]: continue par[v] = u stack.append(v) else: u = ~u sz[par[u]] += sz[u] for v in G[u]: if v == par[u]: continue ans += sz[v] * (N - sz[v]) ans += sz[u] * (N - sz[u]) ans += N N = int(readline()) G = [[] for i in range(N)] for i in range(N - 1): A, B = map(int, readline().split()) A, B = A - 1, B - 1 G[A].append(B) G[B].append(A) ans = 0 non_rec_dfs(0) print(ans)