#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int llint; const int INF = 1000000; const llint LINF = 100000000; int main() { int N; cin >> N; vector V(N); for (int i = 0; i < N; i++) { cin >> V[i]; } vector dp(2); for (int i = 0; i < N; i++) { vector dp2(2); dp2[0] = max(dp[0], dp[1]); dp2[1] = dp[0] + V[i]; dp = dp2; } cout << max(dp[0], dp[1]) << endl; return 0; }