import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val a = new Array[Int](N+1)
  for (i <- 1 to N) {
    a(i) = in.next().toInt
  }

  //
  var ans: List[Int] = Nil
  val dp = new Array[Boolean](N+1)

  def calcDp(n: Int): Int = {
    var num = n.toLong + n
    var res = 0

    if (n == 1) {
      for (i <- 2 to N) 
        if (dp(i))
          res += 1
    }
    else {
      while(num <= N) {
        if (dp(num.toInt))
          res += 1
        num += n
      }
    }

    res
  }


  for (i <- (1 to N).reverse) {
    val tmp = calcDp(i)
    if (a(i) == 1) {
      if(tmp % 2 == 0) {
        ans = i :: ans
        dp(i) = true
      }
    }
    else {
      if(tmp % 2 == 1) {
        ans = i :: ans
        dp(i) = true
      }
    }
  }



  println(ans.length)
  println(ans.mkString(" "))
}

class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
