fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val aListRev = readInputLine().split(" ").map { it.toInt() }.reversed()

    var ansSet = mutableSetOf<Int>()

    for ((i, a) in aListRev.withIndex()) {
        if ((n - i) * 2 > n) {
            if (a == 1) {
                ansSet.add(n - i)
            }
        } else {
            var adder = a == 1
            for (j in (n - i)..n step (n - i)) {
                adder = ansSet.contains(j) xor adder
            }
            if (adder) {
                ansSet.add(n - i)
            }
        }
    }
    
    println(ansSet.size)
    
    for (i in ansSet) {
        println(i)
    }
}

fun readInputLine(): String {
    return readLine()!!
}
