import java.util.ArrayList

fun main(args: Array<String>) {
    val (n) = readLine()!!.split(' ').map(String::toInt)
    val xs = readLine()!!.split(' ').map(String::toInt).toMutableList()
    xs.add(0, -1)
    val result = IntArray(n+2){-1}
    fun calc(i: Int): Int{
        if(result[i] != -1) return result[i]
        if(i * 2 > n) {
            result[i] = xs[i]
            return result[i]
        }
        val upper = (i * 2..n step i).sumBy { it: Int -> calc(it)} % 2
        val ret = if(xs[i] == upper) 0 else 1
        result[i] = ret
        return ret
    }
    calc(1)

    val r = (1..n).filter {it: Int -> result[it] == 1 }

    if (r.isEmpty()) {
        print(0)
    } else {


        println(r.size)
        for (i in r.indices) {
            print(r[i])
            if (i != r.size - 1)
                print(" ")
        }
    }
}