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