fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val bList = readInputLine().split(" ").map { it.toInt() }.toMutableList()
    bList.reverse()
    
    val opReversed = mutableListOf<Int>()
    
    while (bList.isNotEmpty()) {
        var ok = false
        for ((i, b) in bList.withIndex()) {
            if (b == bList.size - i) {
                opReversed.add(b)
                bList.removeAt(i)
                ok = true
                break
            }
        }
        if (!ok) {
            println(-1)
            return
        }
    }
    
    for (op in opReversed.reversed()) {
        println(op)
    }
}

fun readInputLine(): String {
    return readLine()!!
}
