import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) m = map(int, read().split()) UV = zip(m,m) graph = [[] for _ in range(N+1)] for u,v in UV: graph[u].append(v) graph[v].append(u) root = 1 parent = [0] * (N+1) order = [] stack = [root] while stack: x = stack.pop() order.append(x) for y in graph[x]: if y == parent[x]: continue parent[y] = x stack.append(y) dp_0 = [0] * (N+1) dp_1 = [1] * (N+1) for v in order[::-1]: p = parent[v] dp_0[p] += max(dp_0[v], dp_1[v]) dp_1[p] += dp_0[v] answer = max(dp_0[root], dp_1[root]) print(answer)