fun main(args: Array<String>) {
    abc134d()
}

fun abc134d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ")
        .map { it == "0" }

    val ballInBoxes = BooleanArray(n)

    (n - 1 downTo 0).forEach { index ->
        var currAi = index + 1
        var sumModIsZero = true
        while ((currAi - 1) < n) {
            if (ballInBoxes[currAi - 1]) sumModIsZero = !sumModIsZero
            currAi += (index + 1)
        }

        if (aList[index] != sumModIsZero) ballInBoxes[index] = true
    }

    val count = ballInBoxes.count { it }
    println(count)

    if (count > 0) {
        println(ballInBoxes.withIndex().filter { it.value }.map { it.index + 1 }.joinToString(" "))
    }
}
