import sys sys.setrecursionlimit(10 ** 9) import pypyjit pypyjit.set_param('max_unroll_recursion=-1') n = int(input()) edges = [[] for _ in range(n)] for _ in range(n - 1): u, v = map(int, input().split()) u -= 1 v -= 1 edges[u].append(v) edges[v].append(u) size = [1] * n ans = n * n def dfs(pos, bpos): global ans for npos in edges[pos]: if npos == bpos: continue dfs(npos, pos) size[pos] += size[npos] ans += size[npos] * (n - size[npos]) ans += size[pos] * (n - size[pos]) dfs(0, -1) print(ans)