#include <bits/stdc++.h>
using namespace std;
long long int mod;
long long int fac(long long int a) {
  long long int c = 0;
  for (long long int i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      c = i;
      break;
    }
  }
  return c;
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int expmod(long long int a, long long int b) {
  if (b == 1) return a;
  if (b == 0) return 1;
  long long int m1 = expmod(a, b / 2) % mod;
  if (b % 2) return ((m1 * m1) % mod * a % mod) % mod;
  return (m1 * m1) % mod;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long int> v;
  for (int i = 0; i < n; i += 2) {
    v.push_back(a[i]);
  }
  for (int i = 1; i < n; i += 2) {
    v.push_back(a[i]);
  }
  for (int i = 0; i < n; i++) {
    v.push_back(v[i]);
  }
  int k = n / 2 + 1;
  long long int ans = 0, cur = 0;
  for (int i = 0; i < v.size(); i++) {
    cur += v[i];
    if (i >= k) cur -= v[i - k];
    ans = max(ans, cur);
  }
  cout << ans;
  return 0;
}
