N = gets.chomp.to_i
AS = gets.chomp.split.map(&:to_i)

box = [0] * (N + 1)
N.downto(1) do |i|
  sum = 0
  (2 * i).step(N, i) do |j|
    sum += box[j]
  end
  box[i] = 1 if (sum % 2) != AS[i - 1]
end

puts box.inject(0, &:+)
puts box.each_index.select { |i| box[i] == 1}.join(" ")
