#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 2 * 1e18 + 7;
const int base = 2e5 + 1;
const int MAX = 1e5 + 2;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MAXN = 2 * 1e5 + 1;
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2)
    return (binpow(a, n - 1) * a) % MOD;
  else {
    long long b = binpow(a, n / 2) % MOD;
    return (b * b) % MOD;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  vector<long long> e(n), o(n);
  cin >> e[0];
  for (long long i = (1); i < (n); ++i) {
    long long x;
    cin >> x;
    e[i] = e[i - 1];
    o[i] = o[i - 1];
    if (i % 2)
      o[i] += x;
    else
      e[i] += x;
  }
  long long res = 0;
  for (long long i = (0); i < (n); ++i) {
    res = max(res, e[i] + o[n - 1] - o[i]);
    res = max(res, o[i] + e[n - 1] - e[i]);
  }
  cout << res;
  return 0;
}
