#include <bits/stdc++.h>
using namespace std;
long long n;
long long arr[200005];
long long z;
long long buang;
long long sums;
long long temp;
int main() {
  cin >> n;
  z = (n - 1) / 2;
  temp = 0;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n - 1; i++) {
    if (i % 2 == 0) {
      temp += arr[i];
    }
  }
  buang = temp;
  for (long long i = 0; i < n; i++) sums += arr[i];
  for (long long i = 0; i < z; i++) {
    temp += arr[n - 2 - 2 * i] - arr[n - 3 - 2 * i];
    buang = min(temp, buang);
  }
  for (long long i = 0; i < z; i++) {
    temp += arr[n - 1 - 2 * i] - arr[n - 2 - 2 * i];
    buang = min(temp, buang);
  }
  cout << sums - buang << endl;
}
