#include "bits/stdc++.h" using namespace std; int main() { int N, V[1000], DP[1010][2] = {}; cin >> N; for (int i = 0; i < N; i++) cin >> V[i]; for (int i = 1; i <= N; i++) { DP[i][0] = max(DP[i - 1][0], DP[i - 1][1]); DP[i][1] = DP[i - 1][0] + V[i - 1]; } cout << max(DP[N][0], DP[N][1]) << endl; }