#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) ((x)<(y)?(y):(x))

typedef long long ll;
const ll INF = 1LL << 60;
 
int main(){
    int N;
    scanf("%d",&N);
    ll A[N];
    for(int i = 0;i<N;i++) scanf("%lld",&A[i]);
    ll dp[4][N/2];
    for(int i = 0;i<N/2;i++) dp[0][i] = (0LL-INF);
    for(int j = 0;j<N/2;j++){
        for(int i = 1;i<4;i++){
            if(j==0) dp[i][j]=MAX(dp[i-1][j],A[i-1]);
            else if(j>0) dp[i][j]=MAX(dp[i-1][j],dp[i][j-1]+A[2*j+i-1]);
        }
    }
  	if(!(N & 1))printf("%lld\n",dp[2][N/2-1]);
  	else printf("%lld\n",dp[3][N/2-1]);
    return 0;
}