#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  int i,j;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  vector<int>boxes(n);
  int tmp;
  for(i=n;i>0;i--){
    tmp = 0;
    for(j=2*i;j<=n;j+=i){
      if(boxes[j-1]==1)tmp++;
    }
    if(tmp%2==a[i-1])boxes[i-1]=0;
    else boxes[i-1]=1;
  }
  tmp=0;
  for(i=0;i<n;i++){
    if(boxes[i]==1)tmp++;
  }
  cout<<tmp<<endl;
  for(i=0;i<n;i++){
    if(boxes[i]==1)cout<<i+1<<" ";
  }
}
