import sys readline = sys.stdin.readline sys.setrecursionlimit(10**7) def dfs(s, p=-1): v0, v1 = 0, 1 for u in G[s]: if u == p: continue x, y = dfs(u, s) v0 += max(x, y) v1 += max(x, y - 1) return v0, v1 N = int(readline()) G = [[] for i in range(N)] a, b = [0] * (N - 1), [0] * (N - 1) for i in range(N - 1): a[i], b[i] = map(int, input().split()) a[i], b[i] = a[i] - 1, b[i] - 1 G[a[i]].append(b[i]) G[b[i]].append(a[i]) print(max(dfs(0)))