func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int i, j, k, n, m;   pair<int, int> p[N];   int a[N];   int c[N];   int main() {     cin >> n;     for (i = 0; i < n; ++i) {       cin >> p[i].first;       p[i].second = i;     }     sort(p, p + n);     k = 0;     for (i = 0; i < n; ++i) {       c[p[i].first]++;       k = max(k, p[i].first);     }     for (i = 1; i <= k; ++i)       if (c[i] == 0 || (i > 1 && c[i] > c[i - 1])) {         cout << -1 << endl;         return 0;       }     m = 0;     k = 0;     for (i = 0; i < n; ++i) {       if (!i || p[i].first != p[i - 1].first) {         k = 0;       }       ++k;       m = max(m, k);       a[p[i].second] = k;     }     cout << m << endl;     for (i = 0; i < n; ++i) {       cout << a[i] <<    ;     }     return 0;   }   