#include <bits/stdc++.h>
#pragma Optimize("O3")
using namespace std;
int n, x, a, b, y, m, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<int> v(n);
  vector<int> a;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i += 2) a.push_back(v[i]);
  for (int i = 1; i < n; i += 2) a.push_back(v[i]);
  a.insert(a.end(), a.begin(), a.end());
  long long sumtmp = 0;
  for (int i = 0; i < (n + 1) / 2; i++) sumtmp += a[i];
  long long sum = sumtmp;
  for (int i = (n + 1) / 2; i < a.size(); i++) {
    sumtmp += a[i] - a[i - (n + 1) / 2];
    sum = max(sum, sumtmp);
  }
  cout << sum << '\n';
  return 0;
}
