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