#include <iostream>
#include <algorithm>

using namespace std;

long even_solver(long * A, int N){
    long dpl[N/2], dpr[N/2];
    for(int i=0; i<N; i+=2){
        if(i == 0) dpl[i/2] = A[i];
        else dpl[i/2] = A[i] + dpl[i/2-1];
    }
    for(int i=N-1; i>0; i-=2){
        if(i == N-1) dpr[i/2] = A[i];
        else dpr[i/2] = A[i] + dpr[i/2+1];
    }
    long ans = 0;
    for(int i=0; i<N/2; i++){
        if(i == 0) ans = max(ans, dpr[0]);
        else if(i == N/2-1) ans = max(ans, dpl[N/2-1]);
        else ans = max(ans, dpl[i-1] + dpr[i]);
    }
    return ans;
}

int main(){
    int N;
    cin >> N;
    long A[N];
    for(int i=0; i<N; i++) cin >> A[i];
    long ans = even_solver(A, N);
    cout << ans << endl;
    return 0;
}