#include <bits/stdc++.h>
using namespace std;
template <typename T>
void show(const T& v) {
  cerr << v << ' ';
}
template <typename T1, typename... T2>
void show(const T1& first, const T2&... rest) {
  show(first);
  show(rest...);
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const pair<F, S>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const map<F, S>& v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
const double eps = 1e-9;
void solve() {
  long long n;
  cin >> n;
  vector<long long> arr(n + 1), odd(n + 1), even(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    odd[i] = odd[i - 1];
    even[i] = even[i - 1];
    if (i & 1)
      odd[i] += arr[i];
    else
      even[i] += arr[i];
  }
  if (n == 1) {
    cout << arr[1] << "\n";
    return;
  }
  long long mx = 0;
  for (int i = 1; i <= n; i++) {
    long long temp1 = odd[n] - odd[i - 1] + even[i];
    long long temp2 = even[n] - even[i - 1] + odd[i];
    mx = max({mx, temp1, temp2});
  }
  cout << mx << "\n";
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1, cs = 0;
  while (t--) {
    solve();
  }
  return 0;
}
