#include <iostream>
using namespace std;

int main(){
    int n;
    long long int a[200000]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n%2==0){
        long long int s1=0,s2=0;
        int j = 0;
        while(j<n){
            s1 = s1 + a[j];
            j = j + 2;
        }
        j = 1;
        while(j<n){
            s2 = s2 + a[j];
            j = j + 2;
        }
           if(s1>s2){
            cout<<s1<<endl;
        }
        else{
            cout<<s2<<endl;
        }
    }
    else{
        long long int s1=0,s2=0;
        for(int i=0;i<n;i++){
            if(i%2==0){
                s1 = s1 + a[i];
            }
            else{
                s2 = s2 + a[i];
            }
        }
        if(a[0]>a[n-1]){
            s1 = s1 - a[n-1];
        }
        else{
            s1 = s1 - a[0];
        }

        if(s1>s2){
            cout<<s1<<endl;
        }
        else{
            cout<<s2<<endl;
        }
    }
}