import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val n = readInt
  val arr = readLine.split(" ").map(_.toInt).toBuffer
  val outBuf = ArrayBuffer.fill(n)(0)
  var i = 0
  
  var arraySize = n
  while(i < n) {
    var j = arraySize
    var found = false
    while (found == false) {
      j -= 1
      val num = arr(j)
      
      if (num == j + 1) {
        outBuf(arraySize - 1) = num
        arr.remove(j)
        found = true
      }
      
      if (j == 0 && found == false) {
        println(-1)
        sys.exit(-1)
      }
    }
    arraySize -= 1
    i += 1
  }
  
  outBuf.foreach(println)
}