'use strict';

function main(stdin) {
  const input = stdin.trim().split('\n');
  const N = Number(input.shift());
  const A = input[0].split(' ').map(v => parseInt(v, 10));

  const ans = [];

  for (let i = N; i >= 1; --i) {
    let p = 0;
    let n = i;

    while (true) {
      n += i;
      if (n > N) break;
      p ^= A[n - 1];
    }

    ans[i - 1] = p ^ A[i - 1];
  }

  let index = -1;
  for (let i = ans.length - 1; i >= 0; --i) {
    if (ans[i] === 1) {
      index = i;
      break;
    }
  }

  if (index != -1) {
    ans.splice(index + 1);
    console.log(ans.length);
    console.log(ans.join(' '));
  } else {
    console.log(0);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));