#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin.tie(0), cout.tie(0);
  ;
  long long int a, b, t, n, m, k, i, j, l, sum = 0, sum1 = 0, ans = 0;
  vector<long long int> v;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
    if (i & 1) {
      sum1 += a;
    } else
      sum += a;
  }
  ans = max(sum1, sum);
  for (i = 0; i < n; i++) {
    if (i & 1) {
      sum1 -= v[i];
      sum += v[i];
    } else {
      sum -= v[i];
      sum1 += v[i];
    }
    ans = max(ans, max(sum, sum1));
  }
  cout << ans << endl;
  return 0;
}
