import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) ### 木の読み込み yomikomi n = int(input()) ns = [[] for _ in range(n)] for _ in range(n-1): u,v = map(int, input().split()) u -= 1 v -= 1 ns[u].append(v) ns[v].append(u) cs = [0]*n q = [0] cs[0] = 1 while q: u = q.pop() for v in ns[u]: if cs[v]>0: continue cs[v] = 3 - cs[u] q.append(v) val = sum((v==1 for v in cs)) ans = min(val, n-val) print(ans)