#include<bits/stdc++.h>
#include "partition.h"
using namespace std;
extern vector<int> solve(vector<int> A);
std::vector<int> solve(std::vector<int> A)
{
    vector<pair<int,int>>vec;int n=(int)A.size();
    for (int i=0;i<n;i++) vec.push_back({A[i],i});
    sort(vec.begin(),vec.end());bool subtask1=true;
    for (int i=0;i<n;i+=2)
    {
        if (vec[i].first!=vec[i+1].first) {subtask1=false;break;}
    }
    if (subtask1 and n%2==0)
    {
        vector<int> answer;
        for (int i=0;i<n;i+=2) answer.push_back(vec[i].second);
        for (int i=1;i<n;i+=2) answer.push_back(vec[i].second);
        return answer;
    }
    if (n<=25)
    {
        bool subtask2=true;
        for (int i=0;i<n;i++)
        {
            if (A[i]!=(1<<i)) {subtask2=false;break;}
        }
        if (subtask2)
        {
            vector<int> answer;for (int i=n-1;i>=0;i--) answer.push_back(i);
            return answer;
        }
    }
}