const main = (inputs) => {
  var N = inputs[0]-0;
  var arr = inputs[1].split(" ").map(v=>v-0);
  var ans = [];
  for(var i=N;i>0;i--){
    if(i*2<=N){
      var cnt = 0;
      for(var j=i*2;j<=N;j+=i){
        if(ans[j]==1) cnt++;
      }
      if(cnt%2==arr[i-1]) ans[i] = 0;
      else ans[i] = 1;
    }else{
      if(arr[i-1] == 1){
        ans[i] = 1;
      }else{
        ans[i] = 0;
      }
    }
  }
  ans = ans.map((v,i)=>v?i:0).filter(v=>v);
  console.log(ans.length);
  if(ans.length){
    console.log(ans.join(" "));
  }

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
