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