import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void no () { writeln (-1); }

void main() {
  int n;
  readf (" %d", &n);
  auto b = new int[n+1];
  foreach (i; 1 .. n + 1) {
    readf (" %d", &b[i]);
  }
  int[] x;
  foreach_reverse (i; 1 .. n + 1) {
    int bi;
    foreach_reverse (j; 1 .. i + 1) {
      if (b[j] == j) {
        bi = j;
        break;
      }
    }
    if (!bi) {
      no ();
      return;
    }
    x ~= bi;
    foreach (k; bi .. i) {
      b[k] = b[k+1];
    }
    debug stderr.writeln (bi, ' ', b[1 .. i]);
  }
  foreach_reverse (i; x) {
    writeln (i);
  }
  /*
  foreach_reverse (i; 1 .. n + 1) {
    int bi;
    foreach (j; 1 .. i + 1) {
      if (b[i] > i) {
        no ();
        return;
      }
      if (b[i] == i) {
        if (bi) {
          no ();
          return;
        }
        bi = i;
      }
      if (!bi) {
        no ();
        return;
      }
    }
  }
  */
}

