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