"use strict";
const input = require("fs").readFileSync("/dev/stdin", "utf8");
const inputs = input.trim().split("\n");

const get = (inputs) => {
  const As = inputs[1].split(" ");
  const N = As.length;
  const bs = Array(As.length)
  for (let i = N; i > 0; i--) {
    const a = !!(+As[i-1]);
    const n = Math.floor(N/i);
    let count = false;
    let done = false;
    for (let j = n; j > 0; j--) {
      const b = bs[i*j];
      if (b === void 0) {
        bs[i*j] = ((count && a) || (!count && !a)) ? 0 : 1;
        done = true;
        break;
      } else if (b === 1) {
        count = !count
      }
    }
    if (!done) {
      return "-1"
    }
  }
  const balls = [];
  for (let i = 0; i < bs.length; i++) {
    if (bs[i] === 1) balls.push(i)
  }
  return balls.length+"\n"+balls.join(" ")
}

console.log( get(inputs) );