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