n = gets.to_i
a = gets.split.map(&:to_i)
a.unshift(nil)

b = []

n.step(by: -1, to: 1) do |i|
  tmp = 2.step(n/i).inject(0) do |memo, j|
    memo ^ b[i*j]
  end
  b[i] = a[i] ^ tmp
end

ans = b.map.with_index do |v, i|
  i if v == 1
end.compact
puts ans.size
puts ans.join(' ') unless ans.empty?
