import sys readline = sys.stdin.readline sys.setrecursionlimit(10**7) def dfs(s, p=-1): val = 0 for u in G[s]: if u == p: continue val += dfs(u, s) + 1 val -= 2 return max(0, val) N = int(readline()) G = [[] for i in range(N)] for i in range(N - 1): a, b = map(int, readline().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) print(dfs(0))