#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[2 * n + 1], sum[2 * n + 1], ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
  if (n == 1) {
    cout << a[1] << endl;
    return 0;
  }
  sum[1] = a[1];
  for (int i = 2; i <= 2 * n; i++) sum[i] = sum[i - 2] + a[i];
  for (int i = n + 1; i <= 2 * n; i++) {
    ans = max(ans, sum[i] - sum[i - n - 1]);
  }
  cout << ans << endl;
  return 0;
}
