N=int(input ()) V=[int(i) for i in input(). split ()] if N==1: ma=V[0] elif V[0]>V[1]: ma=V[0] la=0 else: ma=V[1] la=1 mal=V[0] for i in range(2,N): # print(ma) # print (mal) if la==0: mal=ma ma+=V[i] la=1 else: c=mal+V[i] if ma>=c: la=0 else: mal=ma ma=c la=1 print(ma)