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

using namespace std;
using ll = long long;

void coutv(vector<int> v) {
    for (auto u : v) {
        cout << u << endl;
    }
}

vector<int> solve(vector<int> A) {
    ll n = A.size();
    vector<int> ans(n);
    ll S = 0;
    for (auto x : A)
    {
        S += (ll) x;
    }
    unordered_map<int, vector<int>> inds;
    for (ll i = 0; i < n; i++)
    {
        inds[A[i]].push_back(i);
    }
    ll cur = 0;
    for (auto u : inds)
    {
        ll csz = u.second.size();
        for (ll i = 0; i < csz / 2; i++)
        {
            ans[cur] = u.second[i];
            ans[n / 2 + cur] = u.second[csz / 2 + i];
            cur++;
        }
    }
    //coutv(ans);
    return ans;
}

/*int main()
{
    ll n;
    cin >> n;
    vector<int> A(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    solve(A);
}*/
