#include #include using namespace std; int main(){ int n; cin >> n; vector vs(n + 3, 0); for (auto i = 1; i <= n; ++i) { cin >> vs[i]; } vector dp(n + 3, 0); dp[0] = 0; dp[1] = vs[1]; for (auto i = 2; i <= n; ++i) { dp[i] = max(dp[i - 2] + vs[i], dp[i - 1]); } cout << dp[n] << endl; }