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] * 2 for _ in range(N)] stack = [(0,-1),(~0,-1)] ans = 0 while stack: now,p = stack.pop() if now < 0: now = ~now for v in G[now]: if v != p: stack.append((v,now)) stack.append((~v,now)) else: for v in G[now]: if v != p: dp[now][0] += 1 dp[now][1] += dp[v][0] ans += 1 + dp[v][0] + dp[v][1] print(ans)