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

sum = Array.new(N + 1, 0)
ans = []

N.downto(1) do |n|
  s = 0
  t = n

  while t <= N
    s += sum[t]
    t += n
  end

  if s % 2 != A[n - 1]
    ans << n
    sum[n] += 1
  end
end

if ans.empty?
  puts 0
else
  puts ans.size
  puts ans.sort.join(' ')
end
