#include <iostream>
#include <vector>
using namespace std;
vector<int> solve(vector<int> A){
    vector<int>fr(100005,0),fn(100005,0),ans;
    vector<bool>marked(A.size());
    for(int i=0;i<A.size();++i){
        fr[A[i]]++;
    }
    for(int i=0;i<A.size();++i){
        if(fn[A[i]]<fr[A[i]]/2){
            ans.push_back(i);
            fn[A[i]]++;
            marked[i]=true;
        }
    }
    for(int i=0;i<A.size();++i){
        if(marked[i]==false){
            ans.push_back(i);
            marked[i]=true;
        }
    }
    return ans;
}