#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
#define ll long long
int difer(vector<int>& v)
{
    ll s = 0;
    for(int i = 0; i < v.size(); i++)
        s += v[i];
    s /= 2;
    ll cnt = 0;
    int stop = -5;
    for(int i = 0; i < v.size(); i++)
    {
        cnt += v[i];
        if(cnt >= s / 2)
        {
            stop = i - 1;
            break;
        }
    }
    if(stop == -5)
        stop = v.size() - 1;
    int lenfirst = stop + 1;
    int lensecond = (v.size() - lenfirst);
    return abs(lenfirst - lensecond);
}
std::vector<int> solve(std::vector<int> A)
{
    vector<int> ind;
    for(int i = 0; i < A.size(); i++)
        ind.push_back(i);
    vector<int> rez;
    int difmin = A.size() + 5;
    do{
        if(difer(ind) < difmin)
            rez = ind, difmin = difer(ind);
    }while(next_permutation(ind.begin(), ind.end()));
    return rez;
    /*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;*/
}