N = gets.to_i
A = Array.new(N + 1, 0)
X = Array.new(N + 1, 0)

gets.split.map(&:to_i).each_with_index{|a,i| A[i + 1] = a }

(1 .. N).reverse_each do |i|
  sum = (1 .. N / i).inject(0){|s, j| s + X[i * j] }
  X[i] = (sum % 2 == A[i] ? 0 : 1)
end
ans = (1 .. N).select{|i| X[i] > 0}

puts ans.size
puts ans * ' '