#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<long long> vec(n);

    for (int i = 0; i < n; i++){
        cin >> vec.at(i);
    }
    
    if (n % 2 == 0){
        long long odd,even;
        odd = 0;
        even = 0;
        for (int i = 0; i < n; i+=2){
            odd += vec.at(i);
            even += vec.at(i+1);
        }
        if (odd > even) {
            printf("%lld\n", odd);
        }
        else {
            printf("%lld\n", even);
        }
    }
    else if ( n == 3 ){
        long long three_min = -1000000000;
        for (int i = 0; i < n; i+=2){
            if(vec.at(i)>three_min) three_min = vec.at(i);
        }
        printf("%lld\n", three_min);
    }
    else{
        vector<long long> odd(n/2 + 1);
        vector<long long> even(n/2);       
        odd.at(0) = vec.at(0);
        even.at(0) = vec.at(1);
        for (int i = 2; i < n; i+=2){
            odd.at(i/2) = odd.at(i/2-1) + vec.at(i);
        }
        for (int i = 3; i < n; i+=2){
            even.at(i/2) = even.at(i/2-1) + vec.at(i);
        }
        long long odd_min = 1000000000;
        for (int i = 0; i < n; i+=2){
            if(vec.at(i)<odd_min) odd_min = vec.at(i);
        }
        long long ans = odd.at(n/2) - odd_min;
        
        for (int i = -1; i < n-3; i+=2){
            for (int j = i + 3; j < n; j+=2){
                long long kari;
                if (i == -1){
                    kari = odd.at(n/2) - odd.at(j/2) + even.at(j/2 -1);
                }
                else {
                    kari = odd.at(n/2) - odd.at(j/2) + odd.at(i / 2) + even.at(j/2 -1) - even.at(i / 2);
                }
                if (kari > ans) ans = kari;
            }
        }
        printf("%lld\n",ans);
    }
}