#include <bits/stdc++.h>
using namespace std;
vector<int> aa(400002);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int x, d;
  long long int max1 = 0;
  d = n / 2 + 1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (i % 2 == 0) {
      aa[i / 2] = x;
      aa[i / 2 + n] = x;
      max1 += x;
    } else {
      aa[d + i / 2 + n] = x;
      aa[d + i / 2] = x;
    }
  }
  long long int sum = max1;
  for (int i = 1; i <= 2 * n - d; i++) {
    sum = sum - aa[i - 1] + aa[i + d - 1];
    if (max1 < sum) max1 = sum;
  }
  cout << max1;
  return 0;
}
