#include #include using namespace std; int main() { int n, v[1101], dp[1101] = {}; cin >> n; for (int i = 1; i <= n; i++)cin >> v[i]; 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] << endl; }