import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}

object Main extends App {
  val out = new java.io.PrintWriter(System.out)
  val n = in.readInt
  var b = in.readLine.split(" ").map(_.toInt).toBuffer
  val a = mu.ListBuffer.empty[Int]

  for(i <- 0 until n) {
    var isFind = false
    for(j <- b.size-1 to 0 by -1 if !isFind) {
      if(b(j) == j+1) {
        a += b(j)
        isFind = true
        // debug(j, b(j))
      }
    }
    if(a.nonEmpty && a.last <= b.size) b.remove(a.last-1)
  }

  if(b.isEmpty) {
    println(a.reverse.mkString("\n"))
  }
  else {
    println(-1)
  }

  def debug(any:Any*):Unit = {
    if(this.getClass.toString == "class Main$") return
    println(any.mkString(" "))
  }
}