func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     iostream::sync_with_stdio(false);     int n;     cin >> n;     vector<int> nums(n);     map<int, int> counts;     for (int i = 0; i < n; i++) {       cin >> nums[i];       counts[nums[i]]++;     }     map<int, int> last;     int k = 0, previous;     for (auto it = counts.begin(); it != counts.end(); it++) {       if (k++ > 0) {         if (previous < it->second) {           cout << -1 << endl;           return 0;         }       }       if (k != it->first) {         cout << -1 << endl;         return 0;       }       previous = it->second;       last[it->first] = 1;     }     int total = 0;     vector<int> ans(n);     for (int i = 0; i < n; i++) {       ans[i] = last[nums[i]]++;       total = max(ans[i], total);     }     cout << total << endl;     for (int i = 0; i < n; i++) {       if (i) cout <<    ;       cout << ans[i];     }     cout << endl;     return 0;   }   