#include <bits/stdc++.h>
using namespace std;
long long int fast_expo(long long int x, long long int p) {
  if (p == 0)
    return 1;
  else if (p % 2 == 0) {
    long long int t = fast_expo(x, p / 2) % 1000000007;
    return (t * t) % 1000000007;
  } else
    return (x * (fast_expo(x, p - 1)) % 1000000007) % 1000000007;
}
int main() {
  int n;
  cin >> n;
  long long int a[n];
  long long int od[n], ev[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << a[0];
    return 0;
  }
  od[0] = 0;
  ev[0] = a[0];
  long long int ans = (a[0] + a[1]);
  for (int i = 1; i < n; i++) {
    if (i % 2 == 0) {
      ev[i] = ev[i - 1] + a[i];
      od[i] = od[i - 1];
    } else {
      od[i] = od[i - 1] + a[i];
      ev[i] = ev[i - 1];
    }
    ans = max(ans, a[i] + a[(i + 1) % n]);
  }
  for (int i = 0; i < n; i++) {
    if (i != 0) {
      ans = max(ans, a[i] + max(od[i - 1] + ev[n - 1] - ev[i],
                                ev[i - 1] + od[n - 1] - od[i]));
    } else {
      ans = max(ans, a[0] + max(od[n - 1] - od[0], ev[n - 1] - ev[0]));
    }
  }
  cout << ans;
}
