import scala.annotation.tailrec
import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {

  val n = readInt()
  val numbers = readLine.trim.split(' ').map(_.toInt)
  operation(numbers) match {
    case Some(l) ⇒
      l.foreach(println)
    case None ⇒
      println(-1)
  }

  @tailrec
  def operation(current: Array[Int], ope: List[Int] = Nil): Option[List[Int]] = {
    if (current.isEmpty) Some(ope)
    else current.indices.reverse.find(i ⇒ current(i) == i + 1) match {
      case None ⇒ None
      case Some(i) ⇒ operation(current.removed(i), i + 1 :: ope)
    }
  }
  implicit class Wrapped(val array: Array[Int]) extends AnyVal {
    def removed(position: Int): Array[Int] = {
      Array.tabulate(array.length - 1){i ⇒ if (i >= position) array(i + 1) else array(i)}
    }
  }
  implicit class Extension[T](val value: T) extends AnyVal {
    @inline def let[A](@inline func: T ⇒ A): A = func(value)
    @inline def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}