#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << '\n'; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n;
    cin >> n;
    long long int arr[n];
    long long int sm = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> arr[i];
      sm += arr[i];
    }
    if (n == 1) {
      cout << sm << '\n';
      return 0;
    }
    long long int ans = 1e18;
    for (long long int st = 0; st <= min(n - 1, 10ll); st++) {
      long long int num = n / 2;
      num--;
      vector<long long int> l, r;
      l.push_back(0);
      r.push_back(0);
      for (long long int i = 1; i <= num; i++) {
        long long int ls = (st + (n - 2) * i) % n;
        long long int rs = (st + (2) * i) % n;
        l.push_back(l.back() + arr[ls]);
        r.push_back(r.back() + arr[rs]);
      }
      long long int mini = 1e18;
      for (long long int i = 0; i <= num; i++) {
        mini = min(mini, arr[st] + l[i] + r[num - i]);
      }
      ans = min(ans, mini);
    }
    cout << sm - ans << '\n';
  }
  return 0;
}
