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

bs = Array.new(n, 0)

(1..n).to_a.reverse.each do |num|
    cnt = 0
    (1..n/num).each do |t|
        cnt = cnt + bs[num * t - 1]
    end
    a = as[num - 1]
    if a != cnt % 2
        bs[num - 1] = 1
    end
end

res = bs.reduce(:+)
puts res
if res > 0
    puts bs.each_with_index
        .select { |b, i| b != 0 }
        .map { |b, i| i + 1 }
        .join(' ')
end
