#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::max;
using std::min;
using std::string;
using std::vector;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<ll> even(n + 1), odd(n + 1);
  for (int i = 1; i <= n; i++) {
    even[i] = even[i - 1], odd[i] = odd[i - 1];
    if (i % 2 == 0) {
      even[i] += a[i];
    } else {
      odd[i] += a[i];
    }
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    bool isodd = i & 1;
    if (isodd) {
      ans = max(ans, odd[i] + even[n] - even[i]);
    } else {
      ans = max(ans, even[i] + odd[n] - odd[i]);
    }
  }
  cout << ans << "\n";
}
