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