#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
long long buffer[400];
long long previousStair[400];
long long previousTwoStair[400];
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
long long n;
cin >> n;
for (long long i = 0; i < n; i++) {
cin >> buffer[i];
}
previousStair[0] = buffer[0];
if (n > 0) {
previousTwoStair[0] = 0;
previousStair[1] = buffer[0] + buffer[1];
previousTwoStair[1] = buffer[1];
if (n > 1) {
for (long long i = 2; i < n; i++) {
previousStair[i] = previousTwoStair[i - 1] + buffer[i];
previousTwoStair[i] = max(previousTwoStair[i - 2], previousStair[i - 2]) + buffer[i];
}
}
}
cout << max(previousStair[n-1], previousTwoStair[n-1]);
return 0;
}