#include <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
#define ll long long
using namespace std;

const int nmax=2e6;

int v[nmax+1],best,n;
bool taken[nmax+1],best_answer[nmax+1];
ll sum;


void bkt(int i,ll cur_sum,int cnt){
    if(i==n || cur_sum>=(sum+1)/2){
        if(cur_sum<(sum+1)/2)
            return;
        int other=n-cnt;
        int dif=abs(other-cnt);
        if(dif<best){
            best=dif;
            for(int i=0;i<n;i++)
                best_answer[i]=taken[i];
        }
        return;
    }
    ///take
    taken[i]=1;
    bkt(i+1,cur_sum+v[i],cnt+1);
    ///dont take
    taken[i]=0;
    bkt(i+1,cur_sum,cnt);
}

vector<int> solve(vector<int>A) {
    n=A.size();
    sum=0;
    best=n;
    for(int i=0;i<n;i++){
        v[i]=A[i];
        sum+=v[i];
    }
    bkt(0,0,0);
    vector<int>answer;
    for(int i=0;i<n;i++)
        if(best_answer[i])
            answer.pb(i);
    for(int i=0;i<n;i++)
        if(!best_answer[i])
            answer.pb(i);
    return answer;
}