n = gets.to_i
a = [0] + gets.split.map(&:to_i)

b = Array.new(n + 1)
ans = []

(n / 2 + 1).upto(n) do |i|
  b[i] = a[i]
  ans << i if a[i] == 1
end


(n / 2).downto(1) do |i|
  sum = 0
  pos = i * 2
  while pos <= n do
    sum += b[pos]
    pos += i
  end
  if a[i] == 0 && sum % 2 == 0
    b[i] = 0
  elsif a[i] == 0 && sum % 2 == 1
    b[i] = 1
    ans << i
  elsif a[i] == 1 && sum % 2 == 0
    b[i] = 1
    ans << i
  elsif a[i] == 1 && sum % 2 == 1
    b[i] = 0
  end
  unless b[i]
    pp a[i]
    pp sum
  end
end

puts ans.size
puts ans.join(' ') if ans.size > 0