import sys sys.setrecursionlimit(1000000) n = int(input()) tree = [[] for i in range(n)] for i in range(n-1): tmp1, tmp2 = map(int, input().split()) tree[tmp1-1].append(tmp2-1) tree[tmp2-1].append(tmp1-1) visited = [False]*n #dpはその時点における最大の木の個数を表す #dp_boolはその頂点が消されるか(=False)残るか(=True)を示す dp = [0]*n dp_bool = [True]*n def dfs(i): visited[i] = True #葉のとき if all([visited[j] for j in tree[i]]): dp[i] = 1 dp_bool[i] = True #葉でないとき else: tmp = True cnt_True = 0 cnt_False = 0 for j in tree[i]: if not visited[j]: dfs(j) if dp_bool[j]: cnt_True += dp[j] - 1 cnt_False += dp[j] else: cnt_True += dp[j] cnt_False += dp[j] cnt_True += 1 if cnt_True > cnt_False: dp[i] = cnt_True dp_bool[i] = True else: dp[i] = cnt_False dp_bool[i] = False dfs((n-1)//2) print(dp[(n-1)//2]) #print(dp_bool)