import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val b = ArrayList(readLine()!!.split(" ").map{it.toInt()})
    val S = ArrayDeque<Int>()

    while (b.isNotEmpty()) {
        var updated = false
        for (i in b.size - 1 downTo 0) {
            if (i + 1 == b[i]) {
                b.removeAt(i)
                S.addLast(i + 1)
                updated = true
                break
            }
        }
        if (!updated) {
            println(-1)
            return
        }
    }

    while (S.isNotEmpty()) {
        println(S.removeLast())
    }
}
