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