#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
const double PI = acos(0) * 2;
long long mi, sum, ans, n, arr[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ans += arr[i];
    if (i != n - 1 && i % 2 == 0) sum += arr[i];
  }
  mi = sum;
  for (int i = n - 1; i != (10 * n - 3) % n; i = (i + 2) % n) {
    sum += arr[i] - arr[(i + 1) % n];
    mi = min(mi, sum);
  }
  cout << ans - mi;
  return 0;
}
