#include <bits/stdc++.h>
using namespace std;
template <typename elemType>
inline void Read(elemType &T) {
  elemType X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  T = (w ? -X : X);
}
int N;
long long Data[200010], Sum0[200010], Sum1[200010];
int main() {
  Read(N);
  for (register int i = 1; i <= N; ++i) {
    Read(Data[i]);
    Sum0[i] = Sum0[i - 1];
    Sum1[i] = Sum1[i - 1];
    if (i % 2 == 0)
      Sum0[i] += Data[i];
    else
      Sum1[i] += Data[i];
  }
  if (N == 1) {
    cout << Data[1] << endl;
    return 0;
  }
  long long Ans = Data[1] + Data[N] + Sum1[N - 1] - Sum1[1];
  for (register int i = 2; i <= N; ++i) {
    long long temp = Data[i] + Data[i - 1];
    if (i % 2 == 0)
      temp += Sum1[i - 2] + Sum0[N] - Sum0[i];
    else
      temp += Sum0[i - 2] + Sum1[N] - Sum1[i];
    Ans = max(Ans, temp);
  }
  cout << Ans << endl;
  return 0;
}
