#include #include #include #include using namespace std; int dp[1010]; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; cin >> N; int V[1010]; for (int i = 0; i < N; ++i) cin >> V[i]; dp[0] = 0; dp[1] = V[0]; for (int i = 2; i <= N; ++i) { dp[i] = max(dp[i-2] + V[i-1], dp[i-1]); } cout << dp[N] << endl; }