#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
long long n, ans;
long long a[maxn], b[maxn], c[maxn];
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    if (i < 2)
      b[i] = a[i];
    else
      b[i] = a[i] + b[i - 2];
  }
  for (int i = n - 1; ~i; i--) {
    if (i > n - 3)
      c[i] = a[i];
    else
      c[i] = a[i] + c[i + 2];
  }
  ans = b[0];
  for (int i = 0; i < n; i++) ans = max(ans, b[i] + c[i + 1]);
  printf("%lld\n", ans);
  return 0;
}
