#include <bits/stdc++.h>

using namespace std;

vector < int > solve ( vector < int > a ) {
    int n = a.size () , i;
    long long s , sum , mina;
    vector < int > perm;
    vector < int > ans ( n );
    for ( i = 0 ; i < n ; i++ )
        perm.push_back ( i );
    s = 0;
    for ( i = 0 ; i < n ; i++ )
        s = s + a[i];
    mina = s + 1;
    do {
        i = 0;
        sum = 0;
        while ( i < n && !( sum >= s / 2 ) )
            sum = sum + a[perm[i++]];
        if ( abs ( n - 2 * i ) < mina ) {
            mina = abs ( n - 2 * i );
            for ( i = 0 ; i < n ; i++ )
                ans[i] = perm[i];
        }
    } while ( next_permutation ( perm.begin () , perm.end () ) );
    return ans;
}
