N = int(input()) UV = [list(map(int, input().split())) for _ in range(N - 1)] D = [0] * (N + 1) for u, v in UV: D[u] += 1 D[v] += 1 ans = 0 for i in range(1, N + 1): ans += max(D[i] - 2, 0) print(ans)