N=gets.to_i
A=gets.split.map(&:to_i).reverse

data = Array.new(N, 0)
ans=[]

N.times do |i|
  num = N-i
  t = N/num
  if t < 2
    data[i] = A[i]
    ans << num if data[i] == 1
  else
    m = num
    sum = 0
    (t-1).times do
      m += num
      sum += data[N-m]
    end
    data[i] = 1 if sum % 2 != A[i]
    ans << num if data[i] == 1
  end
end

size = ans.size
if size == 0
  puts 0
else
  puts size
  puts ans.reverse.join(" ")
end
