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