# -*- coding: utf-8 -*- """ No.45 回転寿司 https://yukicoder.me/problems/no/45 """ import sys from sys import stdin input = stdin.readline def solve(osushi): # 1枚目 next_OK = 0 # 今回の皿をパスして、次の皿を取れる状態にした時の美味しさの最大値 next_NG = osushi[0] # 今回の皿を取った時の美味しさの最大値 # 2枚目以降 for o in osushi[1:]: tmp = next_NG next_NG = next_OK + o next_OK = max(tmp, next_OK) return max(next_OK, next_NG) def main(args): N = int(input()) osushi = [int(x) for x in input().split()] ans = solve(osushi) print(ans) if __name__ == '__main__': main(sys.argv[1:])