#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long mod1 = 1000000007;
int main() {
  long long t;
  cin >> t;
  long long n = t;
  vector<long long> f(n, 0), s(n, 0);
  long long p = 0, q = 0;
  long long a[t];
  for (int i1 = 0; i1 < t; i1++) {
    cin >> a[i1];
    if (i1 % 2 == 0) {
      p += a[i1];
      f[i1] = p;
    } else {
      q += a[i1];
      f[i1] = q;
    }
  }
  long long m = p;
  p = 0;
  q = 0;
  for (int i = n - 1; i > -1; i--) {
    if (i % 2 == 0) {
      p += a[i];
      s[i] = p;
    } else {
      q += a[i];
      s[i] = q;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (f[i] + s[(i + 1)] > m) {
      m = f[i] + s[(i + 1)];
    }
  }
  cout << m << endl;
}
