n = gets.to_i

a = gets.split.map(&:to_i)

res = Array.new(n) { 0 }

n.times do |i|
  x = n - i
  idx = x - 1

  sum = 0
  j = 2
  while j * x <= n
    idx_j = j * x - 1
    sum += res[idx_j]
    sum %= 2
    j += 1
  end

  res[idx] = a[idx] ^ sum
end

res2 = res.map.with_index{|n, i| [n, i + 1] }.select{ |a| a[0] == 1 }.map{|a| a[1] }
puts res2.count
puts res2.join(' ')