import sys sys.setrecursionlimit(10 ** 6) n = int(input()) G = [[] for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) a -= 1; b -= 1 G[a].append(b) G[b].append(a) dp1, dp2 = [0] * n, [1] * n def dfs(now, prev): if now != 0 and len(G[now]) == 1: dp1[now] = 0 dp2[now] = 1 for next in G[now]: if next != prev: dfs(next, now) dp1[now] += max(dp1[next], dp2[next]) dp2[now] += dp1[next] dfs(0, -1) print(n - max(dp1[0], dp2[0]))