import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,*V = map(int,read().split()) x,y = 0,0 for v in V: x,y = max(x,y), x+v answer = max(x,y) print(answer)