#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long arr[n];
  long long left[n], right[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = arr[0];
  for (long long i = 0; i < n; i++) {
    left[i] = arr[i] + (i - 2 >= 0 ? left[i - 2] : 0);
    right[n - i - 1] = arr[n - i - 1] + (n - i + 1 < n ? right[n - i + 1] : 0);
  }
  for (long long i = 0; i < n; i++) {
    sum = max(sum, (i ? left[i - 1] : 0) + right[i]);
  }
  cout << sum << "\n";
}
