#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long mul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long power(long long a, long long b) {
  long long z = 1;
  long long x = a;
  while (b > 0) {
    if (b & 1) z = mul(z, x);
    x = mul(x, x);
    b >>= 1;
  }
  return z;
}
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  if (n == 1) {
    cout << v[0] << endl;
    return 0;
  }
  vector<long long> a;
  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]);
  for (int i = 0; i < n; i++) a.push_back(a[i]);
  int x = (n + 1) / 2;
  long long ans = 0, sum = 0;
  for (int i = 0; i < x; i++) sum += a[i];
  ans = sum;
  for (int i = x; i < 2 * n; i++) {
    sum = sum + a[i] - a[i - x];
    ans = max(ans, sum);
  }
  cout << ans << endl;
}
