fun main(args: Array<String>) {
    val n=readLine()!!.toInt()
    val b=readLine()!!.split(" ").map { intArrayOf(it.toInt(),0) }
    val result = Array(n){0}
    var count = n
    while (count>0){
        for (i in n-1 downTo 0){
            if(b[i][0]-1 == b[i][1]){
                b[i][1]=-2*n
                for (j in i+1 until n)b[j][1]+=1
                count-=1
                result[count]=b[i][0]
                break
            }else if(b[i][0]-1 < b[i][1]|| b[i][0]-1 >i){
                println("-1")
                return
            }
        }

    }
    result.reversed().forEach { println(it) }
}