#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int64_t> a;
  for (int i = 0; i < n; i++) {
    int64_t x;
    cin >> x;
    a.push_back(x);
  }
  int64_t sum = 0;
  int64_t maxsum = 0;
  if (n == 1) {
    cout << a[0] << endl;
    return 0;
  }
  sum += a[0];
  sum += a[1];
  for (int i = 3; i < n; i += 2) sum += a[i];
  maxsum = max(sum, maxsum);
  int j = 1;
  for (int i = 0; i < n; i++) {
    sum -= a[j++ % n];
    sum += a[j++ % n];
    maxsum = max(sum, maxsum);
  }
  cout << maxsum << endl;
}
