require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
a.unshift(nil)
ans = Array.new(n+1, 0)

n.downto(1) do |i|
  sum = a[i]
  cur = i * 2
  while cur <= n
    sum += ans[cur]
    cur += i
  end
  ans[i] = sum % 2
end

# p ans
ans.shift
puts ans.count{|num| num == 1}
puts (1..n).to_a.zip(ans).select{|x,y| y==1}.map{|x,y|x}.join(' ')

