#include using namespace std; int main() { int n; cin >> n; vector v(n); for (int i = 0; i < n; i++) cin >> v.at(i); int taken = v.at(0), nottaken = 0; for (int i = 1; i < n; i++) { int taken_new = nottaken + v.at(i); nottaken = max(taken, nottaken); taken = taken_new; } cout << max(taken, nottaken) << endl; }