fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt().toMutableList()
    A.add(0, 0)
    val C = IntArray(N + 1) { 0 }
    fun even(n: Int): Boolean = (n % 2 == 0)
    for (i in (1..N).reversed()) {
        var sum = 0
        for (n in i .. N step i) {
            if (n % i == 0) sum += C[n]
        }
        if (A[i] == 0 && !even(sum)) C[i] = 1
        if (A[i] == 1 && even(sum)) C[i] = 1
    }
    var ans = C.mapIndexed { index, v -> if (v == 0) 0 else index }.filter { it != 0 }
    println(ans.count())
    println(ans.joinToString(separator = " "))
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
