#include <bits/stdc++.h>
using namespace std;
void fastio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
}
int main() {
  fastio();
  int n;
  cin >> n;
  long long int a[n];
  long long int totsum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    totsum += a[i];
  }
  int m = n - 1;
  m >>= 1;
  long long int cursum = 0;
  for (int i = 0; i < m; i++) cursum += a[2 * i];
  long long int maxsum = totsum - cursum;
  int last = 0;
  int first = 2 * m - 2;
  for (int i = 0; i < n; i++) {
    cursum -= a[last];
    last += 2;
    last %= n;
    first += 2;
    first %= n;
    cursum += a[first];
    maxsum = max(maxsum, totsum - cursum);
  }
  cout << maxsum << "\n";
  return 0;
}
