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