from typing import List def main(): n = int(input().strip()) abi = [list(map(int, input().strip().split())) for _ in range(n - 1)] deg = [0] * (n + 1) for ab in abi: deg[ab[0]] += 1 deg[ab[1]] += 1 ans = 0 for i in range(1, n + 1): ans += max(0, deg[i] - 2) print(ans) main()