#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int maxn = 3e5 + 43;
const int maxm = 2e3 + 43;
const int maxlog = 22;
const long long mod = (long long)1e9 + 7;
const int sq = 340;
const int inf = 1e9;
const long double PI = 3.141592653589793238463;
long long a[maxn];
long long sum[2][maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i) {
      sum[0][i] = sum[0][i - 1];
      sum[1][i] = sum[1][i - 1];
    }
    sum[i % 2][i] += a[i];
  }
  if (n == 1) {
    cout << a[0] << endl;
    return 0;
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    long long j = (i + 1) % n;
    long long cur = a[i] + a[j];
    if (i - 1 >= 0) cur += sum[i % 2][i - 1];
    if (j + 1 < n) cur += sum[j % 2][n - 1] - sum[j % 2][j];
    ans = max(ans, cur);
  }
  long long cur = a[n - 1] + sum[0][n - 2];
  ans = max(ans, cur);
  cout << ans << endl;
  return 0;
}
