#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n;
  cin >> n;
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (int i = 1; i <= n; i += 2) {
    sum += a[i];
  }
  for (int i = 1; i <= n; i += 2) {
    res = max(res, sum);
    sum += a[i + 1] - a[i];
  }
  sum = 0;
  for (int i = 2; i <= n; i += 2) {
    sum += a[i];
  }
  sum += a[1];
  for (int i = 2; i <= n; i += 2) {
    res = max(res, sum);
    sum += a[i + 1] - a[i];
  }
  cout << res << '\n';
  return 0;
}
