N = int(input()) cnt = [0]*N for i in range(N-1): a,b = map(int,input.split()) cnt[a] += 1 cnt[b] += 1 ans = 0 for i in range(N+1): ans += max(cnt[i+1]-2,0) print(ans)