#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3e7 + 10;
int cnt[MAXN];
bool pred[MAXN];
vector<int> ans;
vector<int> solve(vector<int> a){
    int n = a.size();
    for(int i = 0; i < n; i++){
        if(cnt[a[i]] % 2 == 0){
            pred[i] = true;
        }
        cnt[a[i]]++;
    }
    for(int i = 0; i < n; i++){
        if(pred[i] == true){
            ans.push_back(a[i]);
        }
    }
    for(int i = 0; i < n; i++){
        if(pred[i] == false){
            ans.push_back(a[i]);
        }
    }
    return ans;
}
