
fun main(args: Array<String>) {
    val n = readLine()!!.split(" ").map { it.toInt() }[0]
    val a = readLine()!!.split(" ").map { it.toInt() }
    var m = 0
    val flagArray = Array(n+1){ 0 }
    val bArray = Array(n+1) { 0 }.toMutableList()
    for (i in n downTo 1){
        if (flagArray[i] % 2 != a[i-1]) {
            bArray[i] = i
            m++
            for (j in 1 until n) {
                if (j * j > i) break
                if (i % j == 0) {
                    flagArray[j]++
                    val x = i / j
                    if (x != j) flagArray[x]++
                }
            }
        }
    }
    bArray.removeAll{ it == 0 }
    val index = bArray.size
    println(m)
    for (i in 0 until index){
        print("${bArray[i]} ")
    }
}