n = int(input()) g = [[] for _ in range(n)] for _ in range(n - 1): u, v = map(int, input().split()) u -= 1 v -= 1 g[u].append(v) g[v].append(u) dp = [0 for _ in range(n)] par = [None for _ in range(n)] src = 0 st = [~ src, src] while len(st) > 0: cur = st.pop() if cur >= 0: for nxt in g[cur]: if par[cur] == nxt: continue par[nxt] = cur st.append(~ nxt) st.append(nxt) else: dp[~ cur] += 1 if not par[~ cur] is None: dp[par[~ cur]] += dp[~ cur] ans = 0 for y in range(n): ans += n for u in g[y]: if u == par[y]: ans += dp[y] * (n - dp[y]) else: ans += dp[u] * (n - dp[u]) print(ans)