#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

const long long INF = 1LL << 60;

typedef long long ll;

ll max(ll a, ll b){
    if(a<b) return b;
    else return a;
}

int main(){
    ll N=0;
    scanf("%lld",&N);
    ll A[N],DP[N+1][N];
    DP[0][0]=0;DP[1][0]=0;DP[2][0]=0;DP[3][0]=0;
    for(int j = 2;j<=N/2;j++) DP[2*j-2][j] = -INF;
    for(int i = 1;i<N+1;i++) {
        scanf("%lld",A+i-1);
        DP[1][1] = A[0];
        for(int j = i/2-1;j<=(i+1)/2&&j<=N/2;j++) {
            if(i == 1)break;
            if(j<=0) continue;
            DP[i][j] = max(DP[i-2][j-1]+A[i-1],DP[i-1][j]);
        }
    }
    printf("%lld\n",DP[N][N/2]);
    return 0;
}