N = int(input()) G = {i:[] for i in range(1,N+1)} for _ in range(N-1): a,b = map(int,input().split()) G[a].append(b) G[b].append(a) cnt = 0 for i in range(1,N+1): a = len(G[i]) if a>2: cnt += a-2 print(cnt)