fun main(args :Array<String>) {
    val n = readInteger()
    val aArray = readIntegerList().toIntArray()

    var m = 0
    val boxes = IntArray(n)
    for (i in (n - 1) downTo 0) {
        var count = 0
        val s = i + 1
        for (j in i until n step s) {
            count += boxes[j]
        }

        if (count % 2 != aArray[i]) {
            m++
            boxes[i] = 1
        }
    }

    println(m)
    boxes.mapIndexed { index, it ->
        if (it == 1) index + 1 else 0
    }.filter { it > 0 }
    .joinToString(" ")
    .let { println(it) }
}

fun readInteger() = readLine()!!.toInt()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
