from collections import deque n=int(input()) E=[[] for _ in range(n+1)] for _ in range(n-1): a,b=map(int,input().split()) E[a].append(b) E[b].append(a) ans=0 for i in range(1,n+1): D=[10**9]*(n+1) D[i]=0 q=deque([(i)]) while q: x=q.popleft() for e in E[x]: if D[e]>D[x]+1: D[e]=D[x]+1 if D[e]<3: q.append(e) ans+=1 print(ans//2)