func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   const int inf = 0x3f3f3f3f;   int b[maxn];   int a[maxn];   int ma[maxn];   int pre[maxn * 10];   int _find(int x) { return x == pre[x] ? x : pre[x] = _find(pre[x]); }   void _union(int x, int y) {     x = _find(x), y = _find(y);     if (x < y)       pre[x] = y;     else       pre[y] = x;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < maxn * 10; ++i) pre[i] = i;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       ma[i] = max(ma[i - 1], a[i]);     }     bool flag = true;     int x = 0;     for (int i = n; i > 0; --i) {       if (a[i] > ma[i - 1])         b[i] = ma[i - 1];       else         b[i] = a[i] + 1;       b[i] = _find(b[i]);       _union(b[i], b[i] + 1);       _union(a[i], a[i] + 1);       x = max(x, a[i]);     }     if (!flag)       puts( -1 );     else {       for (int i = 1; i <= n; ++i) printf( %d%c , b[i], i == n ?   n  :    );     }     return 0;   }   