N = int(input()) A = list(map(int,input().split())) B = [a-b for a,b in zip(A[::2], A[1::2])] C = [0] for b in B: C.append(C[-1] + b) D = [0] for b in reversed(B): D.append(D[-1] - b) D.reverse() ans = 0 for c,d in zip(C,D): ans = max(ans, c+d) print(ans)