local N = io.read("n")
local A = {}
for i=1, N do
    A[i] = io.read("n")
end

local box = {}
for i=N, 1, -1 do
    local k = i
    local bi = A[i]
    for n=2,1000000 do
        k = k + i
        if k > N then
            break
        end
        bi = bi ~ box[k]
    end
    box[i] = bi
end
local M = 0
for i=1,N do
    if box[i] == 1 then
        M = M + 1
    end
end
print(M)
if M == 0 then return end
local sb = {}
for i=1,N do
    if box[i] == 1 then
        table.insert(sb, tostring(i))
    end
end
print(table.concat(sb, " "))
