#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt")
#define ll long long
std::vector<int> solve(std::vector<int> A)
{
    ll sum;
    ll cnt, maxi;
    ll s = 0;
    for(int i = 0; i < A.size(); i++)
        s += A[i];
    s = (s / 2 + s % 2);
    int rezmask;
    int difmin = A.size() + 5;
    int n = A.size();
    for(int mask = 0; mask < (1 << A.size()); mask++)
    {
        if(abs((int) __builtin_popcount(mask) - (n - __builtin_popcount(mask))) >= difmin)
            continue;
        sum = 0, maxi = 0, cnt = 0;
        for(int i = 0; i < A.size(); i++)
            if(mask & (1 << i))
                cnt++, sum += A[i], maxi = max(maxi, 1ll * A[i]);
        if(sum >= s && sum - maxi < s)
        {
            int first = cnt;
            int second = (A.size() - cnt);
            if(abs(first - second) < difmin)
                difmin = abs(first - second), rezmask = mask;
        }
    }
    vector<int> st;
    maxi = 0;
    int maxpoz = 0;
    for(int i = 0; i < A.size(); i++)
        if(rezmask & (1 << i) && A[i] > maxi)
            maxi = A[i], maxpoz = i;
    for(int i = 0; i < A.size(); i++)
        if((rezmask & (1 << i)) && i != maxpoz)
            st.push_back(i);
    st.push_back(maxpoz);
    for(int i = 0; i < A.size(); i++)
        if(!((1 << i) & rezmask))
            st.push_back(i);
    return st;
    /*vector<int> st, dr;
    int last = 0;
    if(A.size() == 2)
    {
        st.push_back(1);
        st.push_back(0);
        return st;
    }
    for(int i = 0; i < A.size() / 2; i++)
    {
        if(i % 2 == 0)
        {
            st.push_back(i);
            st.push_back(A.size() - i - 1);
            last = 1;
        }
        else
        {
            dr.push_back(i);
            dr.push_back(A.size() - i - 1);
            last = 0;
        }
    }
    if(last && A.size() % 2)
        dr.push_back(A.size() / 2);
    if(!last && A.size() % 2)
        st.push_back(A.size() / 2);
    for(auto it : dr)
        st.push_back(it);
    return st;*/
}
