#include <bits/stdc++.h>
using namespace std;
void mahakal() {}
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
char c[4] = {'D', 'R', 'U', 'L'};
const long long maxN = 5e5 + 5;
long long n;
long long a[maxN];
void solve() {
  cin >> n;
  vector<long long> even, odd;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
  for (long long i = 0; i < 2 * n; i++) {
    if (i & 1)
      odd.push_back(a[i]);
    else
      even.push_back(a[i]);
  }
  long long ps = 0, ans = 0;
  for (long long i = 0; i < odd.size(); i++) {
    if (i <= n / 2) {
      ps += odd[i];
    } else {
      ps -= odd[i - n / 2 - 1];
      ps += odd[i];
    }
    ans = max(ans, ps);
  }
  ps = 0;
  for (long long i = 0; i < even.size(); i++) {
    if (i <= n / 2) {
      ps += even[i];
    } else {
      ps -= even[i - n / 2 - 1];
      ps += even[i];
    }
    ans = max(ans, ps);
  }
  cout << ans << endl;
}
int main() {
  mahakal();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
