N = gets.chomp.to_i
A = [nil] + gets.chomp.split(" ").map(&:to_i)

mid_i = (N.to_f/2).ceil
result = {}
(N).downto(mid_i) do |i|
  result[i] = A[i]
end
(mid_i-1).downto(1) do |i|
  v = result.select { |k,_| k % i == 0}.values.inject(&:+) % 2
  if A[i] == 1 && v.zero?
    result[i] = 1
  elsif A[i] == 0 && v.zero?
    result[i] = 0
  elsif A[i] == 1 && v == 1
    result[i] = 0
  elsif A[i] == 0 && v == 1
    result[i] = 1
  end
end
n = result.values.inject(&:+)
puts n
puts result.select { |k, v| v == 1 }.keys.join(" ") if n > 0
