#include<stdio.h>
long long MAX(long long a,long long b){return a<b?b:a;}
int main(){
  long long n,i,d[100010],l[2][100010]={};
  long long ans=-1e18,r[2][100010]={};
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++)l[i%2][i+2]=l[i%2][i]+d[i];
  if(n%2)l[1][n+1]=l[1][n-1];
  //for(i=0;i<n;i++)printf("%lld %lld %lld\n",i,l[i%2][n+(i%2)],l[i%2][i]);
  if(n%2==0){
    for(i=0;i<n;i++)r[i%2][i]=l[i%2][n+(i%2)]-l[i%2][i];
  }
  else{
    for(i=0;i<n;i++)r[i%2][i]=l[i%2][n-(i%2)+1]-l[i%2][i];
  }/*
  for(i=0;i<n+2;i++)printf("%5lld ",l[0][i]);printf("\n");
  for(i=0;i<n+2;i++)printf("%5lld ",l[1][i]);printf("\n");
  for(i=0;i<n+2;i++)printf("%5lld ",r[0][i]);printf("\n");
  for(i=0;i<n+2;i++)printf("%5lld ",r[1][i]);printf("\n");//*/
  if(n%2==0)ans=MAX(r[1][1],l[0][n]);
  for(i=0;i<n-1;i++){
    ans=MAX(ans,l[0][i]+r[1][i+1]);
    ans=MAX(ans,l[1][i]+r[0][i+1]);
  }
  printf("%lld\n",ans);
  return 0;
}
