#include <bits/stdc++.h>
using namespace std;
void solve(long long testcase) {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long &x : v) cin >> x;
  vector<long long> a, b, c;
  for (long long i = 0; i < n; i++)
    if (i & 1)
      a.push_back(v[i]);
    else
      b.push_back(v[i]);
  for (long long x : a) c.push_back(x);
  for (long long x : b) c.push_back(x);
  for (long long x : a) c.push_back(x);
  for (long long x : b) c.push_back(x);
  long long w = 0;
  for (long long i = 0; i < (n + 1) / 2; i++) w += c[i];
  long long ans = w, l = 0, r = (n + 1) / 2 - 1;
  while (r + 1 < c.size()) {
    w = w - c[l++] + c[++r];
    ans = max(ans, w);
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  for (long long t = 1; t <= T; t++) solve(t);
  return 0;
}
