#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(int i = (s); i < (n); i++)

namespace mp = boost::multiprecision;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n;
  cin >> n;
  
  vector<ll> a(n);
  if(n%2==0) {
    mp::cpp_int A = 0;
    mp::cpp_int B = 0;
    rep(i, 0, n) {
      cin >> a[i];
      if(i%2==0) A += a[i];
      else B += a[i];
    }
    cout << max(A, B) << "\n";
  }
  else {
    mp::cpp_int A = 0;
    mp::cpp_int B = 0;
    mp::cpp_int C = 0;
    rep(i, 0, n) {
      cin >> a[i];
      if(i%2==1) A += a[i];
      else {
        B += a[i];
        C += a[i];
      }
      if(i==0) B -= a[i];
      if(i==n-1) C -= a[i];
    }
    cout << max(A, max(B, C)) << "\n";
  }

}
