def memorize(f): cache = {} def helper(x, y): if (x, y) not in cache: cache[(x, y)] = f(x, y) return cache[(x, y)] return helper @memorize def kaitenzusi(susi_number,before_get): if susi_number == N: return 0 not_get = 0 if before_get == False: not_get = kaitenzusi(susi_number+1, True) + V[susi_number] get = kaitenzusi(susi_number+1, False) return not_get if not_get > get else get N = int(input()) V = [int(num) for num in input().split()] print(kaitenzusi(0, False))