#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long int> A(n);
  for (int i = 0; i < n; i++) cin >> A[i];
  vector<long long int> odds(n, 0), evens(n, 0);
  long long int sum = 0;
  for (int i = 0; i < n; i = i + 2) {
    sum = sum + A[i];
    evens[i] = sum;
  }
  sum = 0;
  for (int i = 1; i < n; i = i + 2) {
    sum = sum + A[i];
    odds[i] = sum;
  }
  long long int best = 0;
  for (int i = 0; i < n - 1; i++) {
    long long int temp = A[i] + A[i + 1];
    if (i % 2 == 0) {
      if (i != 0) temp += evens[i - 2];
      temp += odds[n - 2] - odds[i + 1];
    } else {
      if (i != 1) temp += odds[i - 2];
      temp += evens[n - 1] - evens[i + 1];
    }
    best = max(temp, best);
  }
  best = max(best, evens[n - 1]);
  cout << best << '\n';
  return 0;
}
