#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> pref(n), suf(n);
  pref[0] = a[0];
  suf[n - 1] = a[n - 1];
  for (long long i = 1; i < n; i++) {
    pref[i] = a[i];
    if (i != 1) pref[i] += pref[i - 2];
  }
  for (long long i = n - 2; i >= 0; i--) {
    suf[i] = a[i];
    if (i != n - 2) suf[i] += suf[i + 2];
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans = max(ans, pref[i] + (i == n - 1 ? 0 : suf[i + 1]));
    ans = max(ans, suf[i] + (i == 0 ? 0 : pref[i - 1]));
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(30);
  long long t = 1;
  while (t--) solve();
}
