n = int(input())
A = list(map(int,input().split()))
if n%2 == 0:
    dp_l = [0]*(n//2+1)
    dp_r = [0]*(n//2+1)
    for i in range(n//2):
        dp_l[i+1] = A[2*i]
        dp_r[i+1] = A[2*i+1]
    for i in range(len(dp_l)-1):
        dp_l[i+1] += dp_l[i]
        dp_r[i+1] += dp_r[i]
    ans = 0
    for i in range(n//2+1):
        ans = max(ans,dp_r[n//2]-dp_r[i]+dp_l[i])
    print(ans)