// Slower C++ solution:
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long int

#define llu long long unsigned int

#define pf printf

#define sf scanf

#define f first

#define s second

#define pb push_back

#define mk make_pair

#define pii pair<int ,int>

#define PII pair<ll ,ll>

 

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};

int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

int dx4[] = {0, 0, 1, -1};

int dy4[] = {1, -1, 0, 0};

 

typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

int Set(int N,int pos){return N=N | (1<<pos);}

int reset(int N,int pos){return N= N & ~(1<<pos);}

bool check(int N,int pos){return (bool)(N & (1<<pos));}

const int max=1e9+100;

const ll  MAX=1e18+500;

const int sz=2e5+100;

int mark[sz];

int main()

{

    Khela

    int a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;

    char ch;

    double d;

    string str1,str2,str;

    bool bl,bl1;

    int t,cs=1;

    while(cin>>n)

    {

        memset(mark,0,sizeof mark);

        int ara[n+2];

        for(i=1;i<=n;i++) cin>>ara[i];



        int ct=0;

        for(i=n;i>=1;i--){

           int tot=0;

           for(j=i+i;j<=n;j+=i) tot+=mark[j];

           if(tot % 2 != ara[i]){

               ++ct;

               ++mark[i];

           }

        }

        

        cout<<ct<<endl;

        for(i=1;i<=n;i++){

            if(mark[i]>0){

                cout<<i<<" ";

            }

        }

       if(ct>0) cout<<endl;

      

        

    }











}

// Faster C++ solution for the same problem (measured speedup: 1.7830274918448903x):
/// إِنَّ مَعَ الْعُسْرِ يُسْرًا

/// لَا أَبْرَحُ حَتَّىٰ أَبْلُغَ



#include <bits/stdc++.h>

#include <ext/rope>

#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>



using namespace __gnu_cxx;

using namespace __gnu_pbds;

using namespace std;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



#define ll long long

#define ld  double



#define HabdModeActive ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define S second

#define F first

#define PI acos(-1)

#define MAX 5000005

#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

const int N = 2e5 + 5;

int cnt [N];

int main() {

    HabdModeActive

    int n;

    cin>>n;

    int arr[n+2];

    for(int i=1 ; i<=n; i++)

    {

        cin>>arr[i];

    }

    vector<int>vec;

    for(int i=n ; i>=1  ; i--)

    {

        if(arr[i] != cnt[i]%2)

        {

            vec.push_back(i);

            cnt[i]++;

            for(ll j=1 ;j*j <= i ; j++)

            {

                if(i%j==0 && i!=j)

                {

                    cnt[j]++;

                    if(j*j != i)

                        cnt[i/j]++;

                }

            }

        }

    }

    if(cnt[1]%2 != arr[1])

        cout<<-1;

    else{

        cout<<vec.size()<<endl;

        for(auto v :vec)

            cout<<v<<" ";

    }



    return 0;

}