#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<int> solve(vector<int> A) {
    int n = A.size();
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int x, int y) {
        return A[x] < A[y];
    });
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += A[i];
    }
    int ans = 1e9;
    vector<int> sol;
    for (int mask = 1; mask < (1 << n); ++mask) {
        ll s = 0, last = 0;
        for (int i = 0; i < n; ++i) {
            if (mask & (1 << i)) {
                s += A[ord[i]];
                last = A[ord[i]];
            }
        }
        if (s >= (sum + 1) / 2 && (s - last) < (sum + 1) / 2) {
            int x = __builtin_popcount(mask), y = n - x;
            if (abs(x - y) < ans) {
                ans = abs(x - y);
                sol.clear();
                for (int i = 0; i < n; ++i) {
                    if (mask & (1 << i)) {
                        sol.push_back(ord[i]);
                    }
                }
                for (int i = 0; i < n; ++i) {
                    if (!(mask & (1 << i))) {
                        sol.push_back(ord[i]);
                    }
                }
            }
        }
    }
    return sol;
}

/*
8
2 2 3 2 3 2 2 3
X X   X   X X
6 5 3 1 0 2 4 7 


*/

