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) d0 = [0]*n d1 = [0]*n # 深さ優先探索 (巻き戻しあり) dfs tree q = [(0, -1)] while q: u,prv = q.pop() if u<0: # 返るときの処理 u = ~u v0 = 0 v1 = 1 for v in ns[u]: if v==prv: continue v0 += d1[v] v1 += min(d0[v], d1[v]) d0[u] = v0 d1[u] = v1 else: q.append((~u,prv)) for v in ns[u]: # 進むときの処理 if v==prv: continue q.append((v,u)) ans = min(d0[0], d1[0]) print(ans)