import sys from collections import deque input = sys.stdin.buffer.readline N = int(input()) T = [[] for _ in range(N)] for _ in range(N - 1): a, b = (int(x) - 1 for x in input().split()) T[a].append(b) T[b].append(a) d = deque([0]) nonvisited = [True] * N nonvisited[0] = False bfs_order = [] while d: v = d.popleft() for x in T[v]: if nonvisited[x]: nonvisited[x] = False d.append(x) bfs_order.append((x, v)) dp_black = [0] * N dp_white = [1] * N for v, parent in reversed(bfs_order): dp_black[parent] += max(dp_black[v], dp_white[v]) dp_white[parent] += dp_black[v] print(N - max(dp_white[0], dp_black[0]))