#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long a[N], suma[N], sumb[N];
int main() {
  int n;
  long long ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i & 1)
      suma[i] += a[i];
    else
      sumb[i] += a[i];
    suma[i] += suma[i - 1];
    sumb[i] += sumb[i - 1];
  }
  for (int i = 1; i <= n - 2; i += 2) ans += a[i];
  for (int i = 1; i <= n; i++) {
    if (i & 1)
      ans = max(ans, suma[i] + sumb[n] - sumb[i]);
    else
      ans = max(ans, sumb[i] + suma[n] - suma[i]);
  }
  cout << ans;
  return 0;
}
