# your code goes here #ef su(ln,mi,la): # if ln==1: # return V[ln-1] N=int(input ()) V=[int(i) for i in input(). split ()] if V[0]>V[1]: ma=V[0] la=0 else: ma=V[1] la=1 mal=V[0] for i in range(2,N-1): #print(ma) if la==0: ma+=V[i] la=1 else: c=mal+V[i] if ma>=c: la=0 else: mal=ma ma=c print(ma)