N = int(input()) D = {} for i in range(N-1) : a,b = map(int,input().split()) if a not in D : D[a] = 1 else : D[a] += 1 if b not in D : D[b] = 1 else : D[b] += 1 ans = 0 for i in D.values() : if i >= 3 : ans += i - 2 print(ans)