N = gets.to_i
as = gets.split.map &:to_i
#p "as = #{as}"
bs = Array.new(N+1,0)
bs[N] = as[N-1]
(N-1).downto(1){|i|
    now_index = 2 * i
    sum = 0
    while now_index <= N
       sum += bs[now_index]
       now_index += i
    end
    if sum % 2 == as[i-1]
        bs[i] = 0
    else
        bs[i] = 1
    end
}

m = bs.count(1)
if m == 0
    puts 0
else
    puts m
    list = []
    bs.each.with_index(0){|k,index|
        list.push(index) if k == 1
    }
    puts list.join(" ")
end