import sys sys.setrecursionlimit(10 ** 9) N = int(input()) T = [[] for _ in range(N)] for _ in range(N - 1): a, b = (int(x) - 1 for x in input().split()) T[a].append(b) T[b].append(a) def rec(v, parent): remove, leave = 0, 1 for child in T[v]: if child == parent: continue remove_c, leave_c = rec(child, v) remove += max(remove_c, leave_c) leave += max(remove_c, leave_c - 1) return remove, leave print(max(rec(0, -1)))