#include #include #include #include #include using namespace std; void pall(stack c, vector w) { int sum = 0; while( !c.empty() ) { sum += w[c.top()]; cout << w[c.top()]<< " "; c.pop(); } cout << endl << "sum=" << sum << endl; } int main() { int N; cin >> N; vector W(N); for(int i = 0 ; i < N; i++ ){ cin >> W[i]; } sort( W.begin(), W.end() ); /* for( int i = 0; i < W.size(); i++ ) { cout << W[i] << " " ; } cout << endl; */ int half = 0; for( auto x: W ) { half += x; } if( half%2 == 1 ) { cout << "impossible" << endl; return 0; } half = half / 2; stack s; int sum =0; int i = 0; int a = 0; int b = 0; while( 1 ) { if( i >= N ) { if( !s.empty() ) { i = s.top(); s.pop(); } if( i == N-1 ) { // // cout << __LINE__ << endl; cout << "impossible" << endl; return 0; } sum -= W[i]; i++; } else if( half == sum + W[i] ) { cout << "possible" << endl; return 0; } else if( half > sum + W[i] ) { sum += W[i]; s.push( i ); i++; } else if( half < sum + W[i] ) { //pall( s, W ) ; // cout << "BIG " << i << " " << sum << " " < 0 ); i++; s.pop(); } else { cout << "arienai" << endl; return 0; } } return 0; }