#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
const long long INF = 9e18;
const long long N = 1000000007;
const double eps = 1e-9;
const auto start_time = std::chrono::high_resolution_clock::now();
void zark() {}
long long n;
vector<long long> a(n);
void solve() {
  cin >> n;
  a = vector<long long>(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long k = (n + 1) / 2;
  vector<long long> b;
  for (long long i = 0; i < n; i += 2) b.push_back(a[i]);
  for (long long i = 1; i < n; i += 2) b.push_back(a[i]);
  a = b;
  for (long long i = (0); i < (n); i++) a.push_back(b[i]);
  long long s = 0;
  for (long long i = (0); i < (k); i++) s += a[i];
  long long mx = s;
  for (long long i = (0); i < (2 * n - k); i++) {
    s -= a[i];
    s += a[i + k];
    mx = max(mx, s);
  }
  42;
  cout << mx << '\n';
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  zark();
  return 0;
}
