fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }
    val ans = IntArray(n) { 0 }

    for (i in n-1 downTo 0) {
        val num = aa[i]
        var idx = (i+1)*2

        var cnt = 0
        while (idx <= n) {
            cnt += ans[idx-1]
            idx += (i+1)
        }

        if (num == 0) {
            ans[i] = if (cnt % 2 == 0) 0 else 1
        } else {
            ans[i] = if (cnt % 2 == 1) 0 else 1
        }
    }

    val ansCnt = ans.count { it == 1 }
    println(ansCnt)

    if (ansCnt > 0) {
        println(ans.mapIndexed { index, i -> if (i == 1) index+1 else 0 }.filter { it != 0 }.joinToString(separator = " "))
    }
}