fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val num = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    if(!solve(num)) {
        println(-1)
    }
}

fun solve(num:MutableList<Int>):Boolean {
    val list = mutableListOf<Int>()
    for(i in (0 until 100)) {
        var idx = -1
        for(j in (num.indices.reversed())) {
            if(j + 1 == num[j]) {
                idx = j
                break
            }
        }
        if(idx < 0) {
            return false
        }
        list.add(idx+1)
        num.removeAt(idx)
        if(num.isEmpty()) {
            break
        }
    }
    list.reversed().forEach { println(it) }
    return true
}