#include <iostream>
#include <vector>

using namespace std;
int main(void)
{
  long long n;
  cin >> n;
  vector<long long> a = vector<long long>(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }

  vector<vector<long long>> ms = vector<vector<long long>>(n + 1, vector<long long>(n / 2 + 2));

  for (long long i = 1; i <= n; i++) {
    for (long long j = i / 2 - 1; j <= (i + 1) / 2; j++) {
      if (j > 0) {
	if (i == 1) {
	  ms[1][1] = a[0];
	} else {
	  ms[i][j] = max(ms[i - 2][j - 1] + a[i - 1], ms[i - 1][j]);
	}
      }
    }
  }
  
  cout << ms[n][n / 2] << endl;  
  return 0;
}
