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