n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

ball = Array.new(n,0)
box = []
div = Array.new(n).map{Array.new()}
for i in 1..n do
    j = i
    while j <= n
        div[j-1].push(i)
        j += i
    end
end

tar = n
(1..n).each do |i|
    if a[n-i] != ball[n-i]
        box.push(n-i+1)
        for j in div[n-i] do
            ball[j-1] = 1-ball[j-1]
        end
        # (1..Math.sqrt(tar)).each do |j|
        #     if tar % j == 0
        #         ball[j-1] = 1 - ball[j-1]
        #         if j*j != tar
        #             ball[tar/j -1] = 1 - ball[tar/j -1]
        #         end
        #     end
        # end
    end
    tar -= 1
end

m = box.size
puts m
if m > 0
    puts box.join(' ')
end