#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tests = 1;
  for (long long i = 0; i < tests; i++) {
    long long n;
    cin >> n;
    vector<int> vec;
    for (int j = 0; j < n; j++) {
      int t;
      cin >> t;
      vec.push_back(t);
    }
    long long k = 0;
    bool breaker = false;
    if (n == 1) {
      cout << vec[0] << '\n';
      continue;
    }
    if (n == 3) {
      sort((vec).begin(), (vec).end());
      cout << vec[2] + vec[1] << '\n';
      continue;
    }
    vector<int> vec2;
    for (int j = 0; j < n; j = j + 2) {
      vec2.push_back(vec[j]);
    }
    for (int j = 1; j < n; j = j + 2) {
      vec2.push_back(vec[j]);
    }
    for (int j = 0; j < n; j = j + 2) {
      vec2.push_back(vec[j]);
    }
    long long maxi = 0, sum = 0;
    for (int j = 0; j < (n + 1) / 2; j++) {
      maxi = maxi + vec2[j];
    }
    sum = maxi;
    for (int j = 0; j < n; j++) {
      sum = sum - vec2[j] + vec2[j + (n + 1) / 2];
      maxi = max(maxi, sum);
    }
    cout << maxi << '\n';
  }
}
