from collections import deque N=int(input()) G=[[] for _ in range(N)] for _ in range(N-1): u,v=list(map(int,input().split())) G[u-1].append(v-1) G[v-1].append(u-1) ans=0 for i in range(N): used=set() Q=deque() used.add(i) Q.append((i,0)) while Q: u,d=Q.popleft() if i!=u:ans+=1 if d==3:continue for v in G[u]: if v in used:continue used.add(v) Q.append((v,d+1)) print(ans//2)