N = int(input()) A = list(map(int,input().split())) from itertools import accumulate L = list(accumulate([A[i] - A[i+1] for i in range(0,2*N,2) ], initial = 0)) R = list(accumulate([A[-1-i] - A[-2-i] for i in range(0,2*N,2)], initial = 0)) ans = max(L[i]+R[-1-i] for i in range(N)) print(ans)