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