#include using namespace std; int N; int V[1000]; int dp[1000]; int recursive(int pos) { if(pos >= N) return 0; if(dp[pos] >= 0) return dp[pos]; dp[pos] = max(recursive(pos + 2) + V[pos], recursive(pos + 1)); return dp[pos]; } int main() { cin >> N; for(int i = 0; i < N; i++) { cin >> V[i]; dp[i] = -1; } cout << recursive(0) << endl; return 0; }