from collections import deque n = int(input()) rosen = [[] for _ in range(n+1)] for i in range(n-1): a, b = map(int, input().split()) rosen[a].append(b) rosen[b].append(a) ans = set() def bfs(start): queue = deque([start]) d = [-1] * (n+1) d[start] = 0 while queue: v = queue.popleft() for i in rosen[v]: if d[i] != -1: continue d[i] = d[v] + 1 if d[i] <= 3: if start < i: ans.add((start, i)) else: ans.add((i, start)) queue.append(i) for i in range(1, n+1): bfs(i) print(len(ans))