#include using namespace std; int solve(int n, int v[]) { int dp[n+1]; dp[0] = 0; dp[1] = v[0]; bool flag = true; for (int i = 1; i < n; i++) { if (flag) { if (dp[i] < dp[i-1]+v[i]) { dp[i+1] = dp[i-1] + v[i]; flag = true; } else { dp[i+1] = dp[i]; flag = false; } } else { dp[i+1] = dp[i] + v[i]; flag = true; } } return dp[n]; } int main(int argc, char const* argv[]) { int n; cin >> n; int v[n]; for (int i = 0; i < n; i++) {cin >> v[i];} cout << solve(n, v) << endl; return 0; }