#include "partition.h"
#include<bitset>
#include<algorithm>
#include<iostream>
#include<utility>
#define all(a) a.begin(),a.end()
using namespace std;
const int N=10000;
int n;
inline pair<bool,bitset<N>> ok(int broi,const vector<int>& A,int kolko,bitset<N> b){
    if((kolko<=0 &&broi==0))return {1,b};
    if(broi==0)return {0,{}};
    for(int i=1;i<=n;++i){
            b[i]=1;
        auto [p,b2]=(ok(broi-1,A,kolko-A[i],b));
        if(p){
            return {1,b2};
        }
            b[i]=0;
    }
    return {0,{}};
}
std::vector<int> solve(std::vector<int> A) {
    n=A.size();
    /*A.insert(A.begin(),-1);
    vector<int> pref(A.size());
    sort(all(A));
    for(int i=1;i<=n;++i)pref[i]=pref[i-1]+A[i];
    int S=pref[n];
    int l=0,r=n-1,mid;
    bitset<N> ans;
    while(l<=r){
        mid=(l+r)/2;
            cerr<<"mid"<<mid<<endl;
        auto [p,bits]=ok((n-mid)/2,A,S/2,{});
        if(p){r=mid-1;ans=bits;}
        else {l=mid+1;}
    }*/
    vector<int> out;
    for(int i=1;i<=(n)/4;++i)out.push_back(i-1);
    for(int i=1;i<=(n+3)/4;++i)out.push_back(n-i);
    for(int i=(n)/4;i<n-(n+3)/4;++i)out.push_back(i);
    //for(int i=1;i<=n;++i)if(ans[i])out.push_back(i-1);
    //for(int i=1;i<=n;++i)if(!ans[i])out.push_back(i-1);
    return out;
}
