N = int(input()) G = [[] for _ in range(N+1)] for _ in range(N-1): u,v = map(int,input().split()) G[u].append(v) G[v].append(u) depth = [0] * (N+1) stack = [(1,0)] while stack: now,parent = stack.pop() for v in G[now]: if v == parent:continue depth[v] = depth[now] + 1 stack.append((v,now)) num = [0] * 2 for i in depth[1:]: num[i % 2] += 1 print(min(num))