""" yに関してxがどちら側にいるかだけで変化する yのサイズをYとする x == y の時 N xがyの子の時、(N-Y+1) xがyの親の時、Y """ import sys from sys import stdin sys.setrecursionlimit(200000) ans = 0 def dfs(v,p): global ans tmp = [] for nex in lis[v]: if nex != p: tmp.append ( dfs(nex,v) ) for x in tmp: ans += (N-x) * x ans += N chnum[v] += sum(tmp) rem = N - chnum[v] ans += (N-rem) * rem return chnum[v] N = int(input()) lis = [ [] for i in range(N) ] for i in range(N-1): A,B = map(int,stdin.readline().split()) A -= 1 B -= 1 lis[A].append(B) lis[B].append(A) chnum = [1] * N dfs(0,0) print (ans)