#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> b;
  for (int i = 0; i < n; i += 2) {
    b.push_back(a[i]);
  }
  for (int i = 1; i < n; i += 2) {
    b.push_back(a[i]);
  }
  for (int i = 0; i < n; i++) {
    b.push_back(b[i]);
  }
  long long ans = 0, sum = 0;
  for (int i = 0; i < (n + 1) / 2; i++) {
    sum += b[i];
  }
  ans = sum;
  int l = 1, r = (n + 1) / 2;
  sum -= b[0];
  while (r < int(b.size())) {
    sum += b[r];
    ans = max(ans, sum);
    sum -= b[l];
    l++, r++;
  }
  printf("%lld\n", ans);
}
