#include <bits/stdc++.h>
using namespace std;
void __print(int first) { cerr << first; }
void __print(long first) { cerr << first; }
void __print(long long first) { cerr << first; }
void __print(unsigned first) { cerr << first; }
void __print(unsigned long first) { cerr << first; }
void __print(unsigned long long first) { cerr << first; }
void __print(float first) { cerr << first; }
void __print(double first) { cerr << first; }
void __print(long double first) { cerr << first; }
void __print(char first) { cerr << '\'' << first << '\''; }
void __print(const char *first) { cerr << '\"' << first << '\"'; }
void __print(const string &first) { cerr << '\"' << first << '\"'; }
void __print(bool first) { cerr << (first ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &first) {
  cerr << '{';
  __print(first.first);
  cerr << ',';
  __print(first.second);
  cerr << '}';
}
template <typename T>
void __print(const T &first) {
  int f = 0;
  cerr << '{';
  for (auto &i : first) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long a[n + 1];
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  vector<long long> b;
  b.push_back(0), b.push_back(0);
  for (long long i = 1; i < n + 1; i++) b.push_back(a[i]);
  for (long long i = 1; i < n + 1; i++) b.push_back(a[i]);
  ;
  vector<long long> dp(b.size());
  for (long long i = 2; i < b.size(); i++) dp[i] = dp[i - 2] + b[i];
  ;
  long long best = 0;
  for (long long i = 2; i < b.size(); i++) {
    if (i + n - 1 >= b.size()) break;
    best = max(best, dp[i + n - 1] - dp[i - 2]);
  }
  cout << best << "\n";
}
