#include "partition.h"
#include <bits/stdc++.h>
#define MAXVAL 30000000

using namespace std;

int frecv[MAXVAL + 1];

vector<int> solve(vector<int> A){
    int N, i;
    vector <int> lft, rgt, rez;

    for(i = 0; i <= MAXVAL; i++){
        frecv[i] = 0;
    }
    N = A.size();
    for(i = 0; i < N; i++){
        frecv[A[i]]++;
        if(frecv[A[i]] % 2 == 1){
            lft.push_back(i);
        }else{
            rgt.push_back(i);
        }
    }
    for(i = 0; i < lft.size(); i++){
        rez.push_back(lft[i]);
    }
    for(i = 0; i < rgt.size(); i++){
        rez.push_back(rgt[i]);
    }
    return rez;
}
//1
//4
//2 2 3 3
