n = gets.to_i

as = gets.split.map &:to_i

count = 0
result = []

n.downto(1){ |x|
	bit = 0

	x.step(n, x){ |i|
		bit ^= as[i-1]
	}
	
	if bit == 1 then
		result << x
		count += 1
	end
}

puts count
puts result.sort.join(" ")
