import sys input = sys.stdin.buffer.readline N = int(input()) T = [[] for _ in range(N)] for _ in range(N - 1): u, v = tuple(int(x) - 1 for x in input().split()) T[u].append(v) T[v].append(u) b = [None] * N b[0] = True stk = [0] while stk: v = stk.pop() bx = not b[v] for x in T[v]: if b[x] is None: b[x] = bx stk.append(x) print(min(b.count(True), b.count(False)))