#include #include using namespace std; int dp[1001]; int main(){ int N; cin >> N; for (int i = 1; i <= N; i++)cin >> dp[i]; for (int i = 2; i <= N; i++){ dp[i] = max(dp[i - 1], dp[i]+ dp[i - 2]); } cout << dp[N] << endl; }