#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,i,j,f,sum;
int main(){
    cin>>n;
    vector<int>a(n+1),b(n+1,0);
    for(i=1;i<=n;i++)cin>>a[i];
    for(i=n;i>0;i--){
        for(f=0,j=i;j<=n;j+=i){
            f^=b[j];
        }
        if(a[i]==0&&f==1||a[i]==1&&f==0){
            b[i]=1;
        }
    }
    for(i=1;i<=n;i++)sum+=b[i];
    cout<<sum<<endl;
    for(i=1;i<=n;i++)if(b[i])cout<<i<<endl;
    return 0;
}