def ball_sum(balls, index)
  sum = 0
  m = 1
  while balls.size > (index+1)*m
    sum += balls[(index+1)*m-1]
    m += 1
  end
  sum % 2
end
def a
  n = gets.to_i
  as = gets.split.map(&:to_i)

  result = []
  balls = Array.new(n, 0)
  (0..n-1).to_a.reverse.each do |i|
    balls[i] = ball_sum(balls, i)
    if balls[i] != as[i]
      result << (i+1)
      balls[i] = (balls[i] + 1) % 2
    end
  end
  p result.size
  puts result.join(' ')
end

p -1 if a
