#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int long long n;
  cin >> n;
  int long long ar[n + 1];
  int long long arr[2 * n + 1];
  for (int i = 1; i < n + 1; i++) cin >> ar[i];
  arr[0] = 0;
  int k = 1, j = 1;
  for (int i = 1; i <= n; i++) {
    if (i % 2) {
      arr[j] = ar[i];
      j++;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (i % 2 == 0) {
      arr[j] = ar[i];
      j++;
    }
  }
  for (int i = n + 1; i <= 2 * n; i++) arr[i] = arr[i - n];
  int long long m = (n + 1) / 2;
  int long long ans = 0;
  for (int i = 1; i <= m; i++) {
    ans += arr[i];
  }
  int long long temp = ans;
  for (int i = m + 1; i <= 2 * n; i++) {
    temp = temp + arr[i] - arr[i - m];
    ans = max(ans, temp);
  }
  cout << ans << '\n';
  return 0;
}
