#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> solve(std::vector<int> A) {
    vector<int> ans[2];
    sort(A.begin(), A.end());
    int cnt = 0;
    for(auto it : A) {
        if(ans[0].size() == 0 || (ans[1].size() && A[ans[1].back()] == it)) {
            ans[0].push_back(cnt);
        } else {
            ans[1].push_back(cnt);
        }
        cnt++;
    }
    vector<int> tot;
    for(auto it : ans[1]) tot.push_back(it);
    for(auto it : ans[0]) tot.push_back(it);
    return tot;
}
