#include <bits/stdc++.h>
using namespace std;
const int Max = 3e5 + 5;
long long odd[Max], even[Max], lst[Max];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> lst[i];
    odd[i] = odd[i - 1], even[i] = even[i - 1];
    if (i & 1)
      odd[i] += lst[i];
    else
      even[i] += lst[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i & 1)
      ans = max(odd[n] - odd[i - 1] + even[i], ans);
    else
      ans = max(even[n] - even[i - 1] + odd[i], ans);
  }
  cout << ans << endl;
}
