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

balls = Array.new(N+1, 0)
N.downto(1) do |idx|
  current_balls = 0
  i = 2
  while idx * i < N
    current_balls += balls[idx * i]
    i += 1
  end
  balls[idx] = (current_balls + A[idx]) % 2
end

puts balls.select{|i| i==1 }.count
1.upto(N).each_with_index{|i| puts i if balls[i]==1 }
