require 'prime'

N  = gets.to_i
An = [nil] + gets.split.map(&:to_i)

Primes = Prime.each(N)

Bn = [nil] + [0]*N
N.downto(1){|i|
	rem_sofar = 1 & Primes.inject(0){|acc,pr|
		break acc if N < pr*i
		acc + Bn[pr*i]
	}
	Bn[i] = 1 if An[i] != rem_sofar
}

p Bn.count(1)
puts (1..N).select{|i| Bn[i] == 1 }.join(' ')
