#pragma GCC target optimize("Ofast")
#include "partition.h"
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
using ll = long long;

int _n, sum, res, T;
// vector<pair<int, int>> V;
vector<ll> A;
vector<int> ans;
// set<int> st;

inline int calc(vector<int> &ind) {
    int S = 0;
    int i;
    for (i = 0; i < _n; i++) {
        S += A[ind[i]];
        if (S >= T)
            break;
    }
    int j = _n - i - 1;
    // cerr << i + 1 << '|' << j << endl;
    return abs((i + 1) - j);
}

inline void systemd() {
    res = _n + 1;
    sum = 0;
    A.resize(_n);
    // V.resize(_n);
    // mp.clear();
}

inline void solve2() {
    for (int bit = 0; bit < (1 << (_n)); bit++) {
        vector<int> cur;
        ll S = 0;
        for (int i = 0; i < _n; i++) {
            if ((1 << i) & bit) {
                cur.push_back(i), S += A[i];
            }
        }
        // if (S < T)
        //     continue;
        sort(cur.begin(), cur.end(), [&](int l, int r) {
            return A[l] < A[r];
        });
        for (int i = 0; i < _n; i++) {
            if (!((1 << i) & bit)) {
                cur.push_back(i);
            }
        }
        ll hel = calc(cur);
        if (hel <= res) {
            res = hel, ans = cur;
        }
    }
}

std::vector<int> solve(std::vector<int> A_) {
    _n = A_.size();
    systemd();
    for (int i = 0; i < _n; i++) {
        A[i] = A_[i];
        sum += A[i];
    }
    T = (sum + 1) >> 1;
    solve2();
    return ans;
}

/*
1
4
2 6 4 4
 */
