from collections import deque N = int(input()) edge = [[] for _ in range(N)] for _ in range(N-1): u, v = map(int, input().split()) u -= 1 v -= 1 edge[u].append(v) edge[v].append(u) ans = 0 nxt = deque() used = [False] * N used[0] = True nxt.append(0) while nxt: pos = nxt.pop() for to in edge[pos]: ans += 1 for nt in edge[to]: if nt != pos : ans += len(edge[nt]) if not used[to] : nxt.append(to); used[to] = True print(ans // 2)