#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v(n), l(n), r(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  if (n == 1) {
    cout << v[0];
    return 0;
  }
  long long int ans = 0;
  l[0] = v[0];
  l[1] = v[1];
  for (long long int i = 2; i < n; i++) {
    l[i] = l[i - 2] + v[i];
    ans = max(ans, l[i]);
  }
  r[n - 1] = v[n - 1];
  r[n - 2] = v[n - 2];
  for (long long int i = n - 3; i >= 0; i--) {
    r[i] = r[i + 2] + v[i];
    ans = max(ans, r[i]);
  }
  for (long long int i = 0; i < n - 1; i++) {
    ans = max(ans, l[i] + r[i + 1]);
  }
  cout << ans << "\n";
  return 0;
}
