#include #include #include #include #include #include #include #include #include using namespace std; int main() { int N; cin >> N; vector v(N); int n; for (int i = 0; i < N; ++i) { cin >> n; v[i] = n; } vector dp(N + 2); dp[0] = 0; dp[1] = 0; for (int j = 2; j < N + 2; ++j) { dp[j] = max(dp[j - 2] + v[j - 2], dp[j - 1]); } cout << dp[N + 1] << "\n"; return 0; }