let n = Int(readLine()!)!


func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n)
  for i in (0..<n).reversed() {
    var j = (i + 1) * 2
    var cur = 0
    while j <= n {
      cur += a[j-1]
      j += j
    }
    cur = cur & 1
    if cur == a[i] {
      ans[i] = 0
    } else if a[i] == 0 {
      return []
    } else {
      ans[i] = 1
    }
  }
  return ans
}

var a = readLine()!.split(separator: " ").map { Int($0)! }
let ans = solve(a)

if ans.isEmpty {
  print(-1)
} else {
  let res = ans.enumerated().filter { $1 == 1 }
  print(res.count)
  res.forEach { print($0.0 + 1) }
}