N = gets.to_i # 2*10^5
A = gets.split.map(&:to_i)

results = Array.new(N, 0)

N.times do |i|
  mul = i + 1 # 加算する倍数
  next_idx = i

  while next_idx < A.size do
    results[i] += A[next_idx]
    next_idx += mul
  end

  results[i] %= 2
end

if A != results
  puts '-1'
else
  results.reject!(&:zero?)
  puts results.size
  puts results.join(" ")
end
