import sys sys.setrecursionlimit(1 << 20) N = int(input()) G = [ [] for _ in range(N+1) ] for _ in range(N-1): u,v = map(int, input().split()) G[u].append(v) G[v].append(u) edges = set() from collections import deque def bfs(s): dist = [-1]*(N+1) dist[s] = 0 que = deque() que.append(s) while que: v = que.popleft() for v2 in G[v]: if dist[v2] != -1 or dist[v2]>3: continue dist[v2] = dist[v]+1 if dist[v2]-dist[s]<4: edges.add((min(v2,s),max(v2,s))) que.append(v2) for i in range(1, N+1): bfs(i) #print(edges) print(len(edges))