#include <bits/stdc++.h>
using namespace std;
class book {
 public:
  long long t, a, b, flag;
};
bool compare(pair<long long, long long> p1, pair<long long, long long> p2) {
  if (p1.second == p2.second) return p1.first > p2.first;
  return p1.second > p2.second;
}
int mex(int *A, int n) {
  int C[n];
  for (int i = 0; i < n; i++) C[i] = A[i];
  sort(C, C + n);
  for (int i = 0; i <= n; i++) {
    if (!binary_search(C, C + n, i)) return i;
  }
}
bool check(int *A, int n) {
  for (int i = 0; i < n - 1; i++) {
    if (A[i] > A[i + 1]) return false;
  }
  return true;
}
int main() {
  int T = 1;
  while (T--) {
    long long n;
    cin >> n;
    long long A[n];
    for (int i = 0; i < n; i++) cin >> A[i];
    long long s = 0;
    for (int i = 0; i < n; i++) s += A[i];
    long long B[n + n / 2];
    for (int i = 0; i < n + n / 2; i++) B[i] = A[(i * 2 + 1) % n];
    long long C[n];
    C[0] = 0;
    int ctr = 0;
    int i = 0;
    int j = n / 2 + 1;
    for (int l = 0; l < j; l++) {
      C[0] += B[l];
    }
    long long M = C[0];
    for (int l = 1; l < n; l++) {
      C[l] = C[l - 1] + B[j] - B[i];
      i++;
      j++;
      M = max(M, C[l]);
    }
    cout << M << endl;
  }
  return 0;
}
