#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
using namespace std;
inline void MAX(long long &a, long long b) {
  if (b > a) a = b;
}
int n, h[201000];
long long sum[201000][2];
int main() {
  read(n);
  for (register int i = 1; i <= n; ++i)
    read(h[i]), sum[i][i & 1] = sum[i - 1][i & 1] + h[i],
                           sum[i][(i & 1) ^ 1] = sum[i - 1][(i & 1) ^ 1];
  long long ans = -10000;
  for (register int i = 1; i <= n; ++i) {
    long long tmp1 = sum[i - 1][0] + (sum[n][1] - sum[i][1]);
    long long tmp2 = sum[i - 1][1] + (sum[n][0] - sum[i][0]);
    MAX(ans, sum[n][0] + sum[n][1] - min(tmp1, tmp2));
  }
  printf("%lld\n", ans);
  return 0;
}
