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