#include <vector>
#include <map>
using namespace std;
std::vector<int> solve(std::vector<int> A)
{
    vector<int> st, dr;
    map<int, int> fr;
    for(int i = 0; i < A.size(); i++)
    {
        if(fr[i] % 2 == 1)
            dr.push_back(i);
        else
            st.push_back(i);
    }
    for(auto it : dr)
        st.push_back(it);
    return st;
}