#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pl = pair<ll, ll>;
constexpr int MX = 2e5 + 5;
int n, a[MX];
inline ll solve() {
  ll sum = 0;
  for (int i = 0; i < n; i += 2) sum += a[i];
  ll ans = sum;
  for (int i = 1; i < n; i += 2) ans = max(sum += a[i] - a[i - 1], ans);
  return ans;
}
int main() {
  if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll ans = solve();
  rotate(a, a + 1, a + n);
  cout << max(solve(), ans);
}
