N = gets.to_i
a = gets.split(' ').map(&:to_i)
a.unshift(0)
ballin = []
check = Array.new(N + 1, 0)

N.downto(1) do |i|
	if i > N / 2 && a[i] == 1
		ballin.unshift(i)
		check[i] = 1
	else
		mul = []
		t = N / i
		n = 0
		t.downto(2) do |j|
			n += 1 if check[i * j] == 1
		end
		if n & 1 != a[i]	
			ballin.unshift(i)
			check[i] = 1
		end
	end
end
cnt = ballin.size
puts cnt
if cnt > 0
	puts ballin.join(' ')
end