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) even = 0 odd = 0 import sys sys.setrecursionlimit(10 ** 8) def dfs(now = 1,parent = 0,depth = 0): global even global odd if depth % 2 == 0:even += 1 else:odd += 1 for v in G[now]: if v != parent: dfs(v,now,depth +1) dfs() print(min(eve,odd))