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

const long long INF = 1L << 30;


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

int main(){
    int N;
    scanf("%d",&N);
    long A[N],DP[N+1][N];
    DP[0][0]=-INF;DP[1][0]=-INF;DP[2][0]=-INF;DP[3][0]=-INF;
    for(int j = 2;j<=N/2;j++) DP[2*j-2][j] = -INF;
    for(int i = 1;i<N+1;i++) {
        scanf("%ld",&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("%ld\n",DP[N][N/2]);
    return 0;
}