#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100005;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base ::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long mx = 0;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    if (i % 2 == 0) {
      sum += a[i];
    }
  }
  mx = sum;
  for (long long i = 0; i <= n - 1; i += 2) {
    sum -= a[i];
    sum += a[(i + 1) % n];
    mx = max(mx, sum);
  }
  long long b[n];
  for (long long i = 0; i < n; i++) {
    b[(i + 1) % n] = a[i];
  }
  for (long long i = 0; i < n; i++) {
    a[i] = b[i];
  }
  sum = 0;
  for (long long i = 0; i < n; i++) {
    if (i % 2 == 0) {
      sum += a[i];
    }
  }
  mx = max(mx, sum);
  for (long long i = 0; i <= n - 1; i += 2) {
    sum -= a[i];
    sum += a[(i + 1) % n];
    mx = max(mx, sum);
  }
  cout << mx;
  return 0;
}
