object Main extends App {
  val n = io.StdIn.readLine.toInt
  val as = io.StdIn.readLine.split(" ").map(_.toInt)
  var bs = new Array[Int](n)

  val bool = (n to 1 by -1).foldLeft(true)((b, i) => b match {
    case false => false
    case true => {
      val bb = (i * 2 to n by i).map(x => bs(x - 1)).sum & 1
      if (bb == 0) {
        bs(i - 1) = as(i - 1)
        true
      } else if (bb == 1 && as(i - 1) == 1) {
        bs(i - 1) = 0
        true
      } else {
        false
      }
    }
  })

  if (bool) {
    val bs2 = bs.zipWithIndex.filter(t => (t._1 & 1) == 1)
    println(bs2.length)
    println(bs2.map(t => t._2 + 1).mkString(" "))
  } else
    println(-1)
}
