#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
int n;
long long a[maxn];
long long before[maxn], after[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    if (i < 2)
      before[i] = a[i];
    else
      before[i] = a[i] + before[i - 2];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i > n - 3)
      after[i] = a[i];
    else
      after[i] = a[i] + after[i + 2];
  }
  long long ans = after[0];
  for (int i = 0; i < n - 1; ++i) ans = max(ans, before[i] + after[i + 1]);
  cout << ans << endl;
  return 0;
}
