#include <bits/stdc++.h>

using namespace std;

map <int, int> mp;

vector <int> solve ( vector <int> A ) {
    vector <int> ans = {};
    mp.clear();
    for ( auto it: A ) {
        mp[it]++;
    }
    sort ( A.begin(), A.end() );
    for ( int i = 0; i < A.size(); ) {
        for ( int j = i; j < i+mp[A[i]]; j++ ) {
            ans.push_back ( j );
        }
        i = j;
    }
    for ( int i = 0; i < A.size(); ) {
        for ( int j = i+mp[A[i]]/2; j < i+mp[A[i]]; j++ ) {
            ans.push_back ( j );
        }
        i = j;
    }

    return ans;
}