#include using namespace std; int dp[1010][2]; int N; int v[10000]; int rec(int n, int k){ if (dp[n][k] > -1) return dp[n][k]; dp[n][1] = rec(n - 1,0) + v[n - 1]; dp[n][0] = max(rec(n - 1, 0),rec(n- 1, 1)); return dp[n][k]; } int main(){ cin >> N; for (int i = 0; i < N; ++i){ cin >> v[i]; } memset(dp, -1, sizeof(dp)); dp[0][0] = dp[0][1] = 0; int res = max( rec(N,0), rec(N, 1)); cout << res << endl; }