#include <bits/stdc++.h>
using namespace std;
void fastio() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = (int)2e5 + 7;
int n;
long long a[N], s[2][N];
long long get(int mod, int l, int r) { return s[mod][r] - s[mod][l - 1]; }
int main() {
  fastio();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[0][i] = s[0][i - 1];
    s[1][i] = s[1][i - 1];
    s[i % 2][i] += a[i];
  }
  long long sol = get(1, 1, n);
  for (int i = 1; i < n; i++) {
    sol = max(sol, get(i % 2, 1, i) + get((i + 1) % 2, i + 1, n));
  }
  cout << sol << "\n";
  return 0;
}
