#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { int N; cin >> N; vector V(N); for ( int i = 0; i < N; i++ ) { cin >> V[i]; } int dp[1000][2]; dp[0][0] = 0; dp[0][1] = V[0]; for ( int i = 1; i < N; i++ ) { dp[i][0] = max( dp[i-1][1], dp[i-1][0] ); dp[i][1] = dp[i-1][0] + V[i]; } cout << max( dp[N-1][1], dp[N-1][0] ) << endl; return 0; }