fun readInts() = readLine()!!.split(' ').map(String::toInt)

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readInts()
    val bb = IntArray(n)
    (n - 1 downTo 0).forEach {
        val i = it + 1
        val sum = (i + i - 1 until n step i).map { bb[it] }.sum()
        if (sum % 2 != aa[it]) {
            bb[it] = 1
        }
    }
    println(bb.count { it == 1 })
    bb.forEachIndexed { i, e ->
        if (e == 0) return@forEachIndexed
        print(i + 1)
        if (i != bb.size - 1) {
            print(' ')
        }
    }
}
