from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,pprint,fractions sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split())) def err(x): print(x); exit() n = inp() g = [[] for _ in range(n)] for _ in range(n-1): a,b = inpl_1() g[b].append(a); g[a].append(b) res = 0 def dfs(u,p=-1): global res su = 0 for v in g[u]: if p==v: continue now = dfs(v,u) res += now*(n-now) su += now up = (n-su-1) res += up*(n-up) res += n return su+1 dfs(0) print(res)