#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define init(arr, val) for (i=0;i<end;i++) arr[i] = val;
#define prlong longlong long(i0, i1) prlong longf("%d %d\n", i0, i1)

using namespace std;
const long long inf = pow(10,9);
const long long nil = -1;
long long i, j, n, m, k, ans;
long long a[200000];
long long accumeven[100000];
long long accumodd[100000];

long long calc(long long i) {
    if (i == 1) return max(max(a[0], a[1]), a[2]);
    long long sum = accumeven[i-1];
    for (j=1;j<i;j++) sum = max(accumeven[j-1] + accumodd[i-1] - accumodd[j-1], sum);
    sum = max(a[n]+calc(i-1), sum);
    return sum;
}

int main() {
    scanf(" %lld", &n);
    rep(0,n) {
        scanf(" %lld", &a[i]);
        if (i == 0) accumeven[i] = a[i];
        else if (i == 1) accumodd[i] = a[i];
        else if (i%2 == 0) accumeven[i] = accumeven[i-1] + a[i];
        else accumodd[i] = accumodd[i-1] + a[i];
    }
    if (n%2 == 0) {
        long long even = 0;
        long long odd = 0;
        rep(0, n/2) {
            even += a[2*i];
            odd += a[2*i+1];
        }
        printf("%lld\n", max(even, odd));
    } else {
        ans = calc(n);
        printf("%lld\n", ans);
    }
}