#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
  for (Tp current = _begin; current != _end; ++current) {
    std::cout << *current << _delim;
  }
  std::cout << '\n';
}
using ll = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);
ll pref[2][200000];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> arr(n + n);
  for (int i = 0; i < (n); ++i) {
    cin >> arr[i];
    arr[n + i] = arr[i];
  }
  for (int i = 0; i < n + n; i += 2) {
    if (i > 0) {
      pref[0][i >> 1] = pref[0][(i >> 1) - 1];
      pref[1][i >> 1] = pref[1][(i >> 1) - 1];
    }
    pref[0][i >> 1] += arr[i];
    if (i + 1 < n + n) {
      pref[1][i >> 1] += arr[i + 1];
    }
  }
  ll ans = 0;
  auto Sum = [](int t, int r, int l) {
    return pref[t][r] - (l > 0 ? pref[t][l - 1] : 0LL);
  };
  for (int i = n / 2; i < n; ++i) {
    ans = max({ans, Sum(0, i, i - (n >> 1)), Sum(1, i, i - (n >> 1))});
  }
  cout << ans << "\n";
  return 0;
}
