//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <iostream>
#include <cmath>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstring>

using namespace std;
//using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fread(p) freopen(p,"r",stdin);
#define fwrite(p) freopen(p,"w",stdout);
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define nl "\n"
#define mem(s,k) memset(s, k, sizeof(s))
#define sf scanf
#define pf printf
#define PI 2*acos(0.0)
#define ALL(p) (p.begin(),p.end())
#define mod(a,b) ((((a)%(b))+(b))%(b))
#define time_start clock_t start = clock();
#define time_end clock_t finish = clock(); cout << (double)(finish-start)/CLOCKS_PER_SEC << endl;
const double EPS = 1e-9;

////--- Graph Moves---////
//const ll xx[] = {0,0,1,-1};
//const ll yy[] = {1,-1,0,0};
//const ll xx_king[] = {0,0,1,-1,1,1,-1,-1};
//const ll yy_king[] = {1,-1,0,0,1,-1,1,-1};
//const ll xx_knight[]= {-2,-1,1,2,2,1,-1,-2};
//const ll yy_knight[]= {1,2,2,1,-1,-2,-2,-1};
////------------------////

ll POW(ll b,ll p) {ll Ans=1; while(p){if(p&1)Ans=(Ans*b);b=(b*b);p>>=1;}return Ans;}
ll BigMod(ll b,ll p,ll Mod) {ll Ans=1; while(p){if(p&1)Ans=(Ans*b)%Mod;b=(b*b)%Mod;p>>=1;}return Ans%Mod;}
ll ModInverse(ll b,ll Mod) {return BigMod(b,Mod-2,Mod);}

string tostr(ll n) {stringstream rr;rr<<n;return rr.str();}
//template<typename T> using orderedSet = tree< T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

////----------- Bit Manipulation -----------------//
//int bitOn(int N,int pos){return N=N OR (1<<pos);}
//int bitOff(int N,int pos){return N= N &~(1<<pos);}
//bool bitCheck(int N,int pos){return (bool)(N & (1<<pos));}
////---------------------------------------------//

////------------ Debugging -----------------------//
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ",   ";
    deb(++it, args...);
}

#define ekhane(k) cerr << "Ekhane asche-" << k << "\n";
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?'\n':' ')
////-----------------------------------------------//


int main()
{
    int n;
    cin >> n;
    int a[n+5];
    for(int i=1; i<=n; i++)
        cin >> a[i];
    int ball[n+5] = {0};
    int ans = 0;
    for(int i=n; i>=1; i--)
    {
        int cnt = 0;
        for(int j=i; j<=n; j+=i){
//            debug(j);
            cnt += ball[j];
        }
        if(cnt%2 != a[i])
            ball[i]++, ans++;
    }
    cout << ans << nl;
    if(ans > 0)
        for(int i=1; i<=n; i++)
            if(ball[i] > 0)
                cout << i << " ";
    cout << nl;
}


Measured memory_bytes: 2432