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