stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
// ABC134-D

#include <bits/stdc++.h>

#define endl "\n"

#define rep(i,n) for(int i=0;i<int(n);i++)

#define SZ(x) ((int)(x).size())

#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int> ipair;

typedef pair<ll,ll> lpair;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る

{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る

void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る



vector<int> a(200010,0);

vector<int> c(200010,0); 

vector<bool> sh(200010,false); //ボールを入れる

int ball=0;

int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    cout << fixed << setprecision(12);



    int n;

    cin>>n;

    rep(i,n) cin>>a[i+1];

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

        if(c[i]%2!=a[i]){

            ball++;

            sh[i]=true;

            for(int j=1;j*j<=i;j++){

                if(i%j==0){

                    c[j]++;

                    if(j*j!=i) c[i/j]++;

                }

            }

        }

    }

    cout<<ball<<endl;

    if(ball!=0){

        rep(i,n){

            if(sh[i+1]) cout<<i+1<<" ";

        }

        cout<<endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.433665904732653x):
// ABC134-D

#include <bits/stdc++.h>

#define endl "\n"

#define rep(i,n) for(int i=0;i<int(n);i++)

#define SZ(x) ((int)(x).size())

#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int> ipair;

typedef pair<ll,ll> lpair;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る

{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る

void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る



vector<bool> sh(200010,false);

vector<int> a(200010,0);

int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    cout << fixed << setprecision(12);



    int n;

    cin>>n;

    int ball=0;

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

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

        int j=i;

        int baisu=0;

        while(j<=n){

            if(sh[j]) baisu++;

            j+=i;

        }

        if(baisu%2!=a[i]) sh[i]=true,ball++;

    }

    cout<<ball<<endl;

    if(ball!=0){

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

            if(sh[i]) cout<<i<<" ";

        }

        cout<<endl;

    }

    return 0;

}
// 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];

vector<int> test;

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)

    {

        test.clear();

        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--){

            p=mark[i];

            x=0;

            if(p%2 != ara[i]) ++x,++ct,test.pb(i);

            if(x>0){

                int sq=sqrt(i);

                for(j=1;j<=sq;j++){

                    if(i%j==0){

                        ++mark[j];

                        if(j*j != i) ++mark[i/j];

                    }

                }

            }

        }

        reverse(test.begin(),test.end());

        cout<<ct<<endl;

        if(test.size()>0){

        for(auto xx: test) cout<<xx<<" ";

        cout<<endl;

        }

      

        

    }











}

// Faster C++ solution for the same problem (measured speedup: 1.7847433989838104x):
#include <bits/stdc++.h>

using namespace std;

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

#define X first

#define Y second

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define All(x) x.begin() , x.end()

#define mem(aa,x) memset(aa,x,sizeof aa)

#define pb push_back

typedef long long ll;

typedef pair<int,int> ii;

const int maxn=4e5+5;



main(){IOS

	int N,sum=0;

	cin>>N;

	bool a[N+1],b[N+1]={};

	vector<int> ans;

	

	rep(i,1,N) cin>>a[i];

	for(int i=N;i>=1;i--){

		int temp=0;

		for(int j=i;j<=N;j+=i) temp+=b[j];

		if(temp%2!=a[i]){

			b[i]=1;

			sum++;

			ans.pb(i);

		}

	}

	

	cout<<sum<<"\n";

	for(auto i:ans) cout<<i<<" ";

	cout<<"\n";

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

#define maxn 200005

using namespace std;



int arr[maxn], box[maxn];

vector<int> ans;

int n;



int main() {

    scanf("%d", &n);

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

        scanf("%d", arr + i);

    }

    ans.clear();

    memset(box, 0, sizeof(box));

    for(int i = n; i > 0; i--) {

        int sum = 0;

        for(int j = i + i; j <= n; j += i) {

            sum += box[j];

        }

        if(sum % 2 != arr[i]) box[i] = 1;

        if(box[i]) ans.push_back(i);

    }

    printf("%d\n", (int)ans.size());

    for(int i = 0; i < (int)ans.size(); i++) {

        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7579618178466017x):
#include <bits/stdc++.h>

using namespace std;

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

#define X first

#define Y second

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define All(x) x.begin() , x.end()

#define mem(aa,x) memset(aa,x,sizeof aa)

#define pb push_back

typedef long long ll;

typedef pair<int,int> ii;

const int maxn=4e5+5;



main(){IOS

	int N,sum=0;

	cin>>N;

	bool a[N+1],b[N+1]={};

	vector<int> ans;

	

	rep(i,1,N) cin>>a[i];

	for(int i=N;i>=1;i--){

		int temp=0;

		for(int j=i;j<=N;j+=i) temp+=b[j];

		if(temp%2!=a[i]){

			b[i]=1;

			sum++;

			ans.pb(i);

		}

	}

	

	cout<<sum<<"\n";

	for(auto i:ans) cout<<i<<" ";

	cout<<"\n";

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

#define MAX_N 200000 + 1

using namespace std;



int N, number[MAX_N], ans[MAX_N];



bool check(){

	for(int i = 1; i <= N; i++){

		int cnt = 0;

		for(int j = i; j <= N; j += i)

			cnt += ans[j];

		cnt %= 2;

		if(cnt ^ number[i]) return false;

	}

	return true;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	

	while(cin >> N){

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

			cin >> number[i];

		

		for(int i = N; i > 0; i--){

			int cnt = 0;

			for(int j = i; j <= N; j += i)

				cnt += ans[j];

			cnt %= 2;

			ans[i] = cnt ^ number[i];

		}

		

		if(check()){

			int sum = 0;

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

				if(ans[i]) sum++;

			cout << sum << endl;

			if(sum){

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

					if(ans[i]) cout << i << " ";

				cout << endl;

			}

		}

		else

			cout << -1 << endl;

		

		memset(number, 0, sizeof(number));

		memset(ans, 0, sizeof(ans));

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.555497429082858x):
#include <bits/stdc++.h>

using namespace std;

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

#define X first

#define Y second

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define All(x) x.begin() , x.end()

#define mem(aa,x) memset(aa,x,sizeof aa)

#define pb push_back

typedef long long ll;

typedef pair<int,int> ii;

const int maxn=4e5+5;



main(){IOS

	int N,sum=0;

	cin>>N;

	bool a[N+1],b[N+1]={};

	vector<int> ans;

	

	rep(i,1,N) cin>>a[i];

	for(int i=N;i>=1;i--){

		int temp=0;

		for(int j=i;j<=N;j+=i) temp+=b[j];

		if(temp%2!=a[i]){

			b[i]=1;

			sum++;

			ans.pb(i);

		}

	}

	

	cout<<sum<<"\n";

	for(auto i:ans) cout<<i<<" ";

	cout<<"\n";

}
// 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];

vector<int> test;

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)

    {

        test.clear();

        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--){

            p=mark[i];

            x=0;

            if(p%2 != ara[i]) ++x,++ct,test.pb(i);

            if(x>0){

                int sq=sqrt(i);

                for(j=1;j<=sq;j++){

                    if(i%j==0){

                        ++mark[j];

                        if(j*j != i) ++mark[i/j];

                    }

                }

            }

        }

        reverse(test.begin(),test.end());

        cout<<ct<<endl;

        if(test.size()>0){

        for(auto xx: test) cout<<xx<<" ";

        cout<<endl;

        }

      

        

    }











}

// Faster C++ solution for the same problem (measured speedup: 1.804384942282223x):
#include <iostream>

#include <vector>

using namespace std;



vector <int> num, rec;



int main() {

	int n;

	cin >> n;

	num.resize(n + 1);

	rec.resize(n + 1);

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

		cin >> num[i];

		rec[i] = 0;

	}

	

	vector <int> ans;

	for(int i = n; i > 0; --i) {

		int sum = 0;

		int j = 2 * i;

		while(j <= n) {

			sum += rec[j];

			j += i;

		}

		if(sum % 2 != num[i]) {

			rec[i] = 1;

			ans.push_back(i);

		}

	}

	

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

	

	for(int i = 0; i < ans.size(); ++i) {

		cout << ans[i] << " ";

	}

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

#define maxn 200005

using namespace std;



int arr[maxn], box[maxn];

vector<int> ans;

int n;



int main() {

    scanf("%d", &n);

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

        scanf("%d", arr + i);

    }

    ans.clear();

    memset(box, 0, sizeof(box));

    for(int i = n; i > 0; i--) {

        int sum = 0;

        for(int j = i + i; j <= n; j += i) {

            sum += box[j];

        }

        if(sum % 2 != arr[i]) box[i] = 1;

        if(box[i]) ans.push_back(i);

    }

    printf("%d\n", (int)ans.size());

    for(int i = 0; i < (int)ans.size(); i++) {

        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.777308623209126x):
#include <iostream>

#include <vector>

using namespace std;



vector <int> num, rec;



int main() {

	int n;

	cin >> n;

	num.resize(n + 1);

	rec.resize(n + 1);

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

		cin >> num[i];

		rec[i] = 0;

	}

	

	vector <int> ans;

	for(int i = n; i > 0; --i) {

		int sum = 0;

		int j = 2 * i;

		while(j <= n) {

			sum += rec[j];

			j += i;

		}

		if(sum % 2 != num[i]) {

			rec[i] = 1;

			ans.push_back(i);

		}

	}

	

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

	

	for(int i = 0; i < ans.size(); ++i) {

		cout << ans[i] << " ";

	}

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

#define MAX_N 200000 + 1

using namespace std;



int N, number[MAX_N], ans[MAX_N];



bool check(){

	for(int i = 1; i <= N; i++){

		int cnt = 0;

		for(int j = i; j <= N; j += i)

			cnt += ans[j];

		cnt %= 2;

		if(cnt ^ number[i]) return false;

	}

	return true;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	

	while(cin >> N){

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

			cin >> number[i];

		

		for(int i = N; i > 0; i--){

			int cnt = 0;

			for(int j = i; j <= N; j += i)

				cnt += ans[j];

			cnt %= 2;

			ans[i] = cnt ^ number[i];

		}

		

		if(check()){

			int sum = 0;

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

				if(ans[i]) sum++;

			cout << sum << endl;

			if(sum){

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

					if(ans[i]) cout << i << " ";

				cout << endl;

			}

		}

		else

			cout << -1 << endl;

		

		memset(number, 0, sizeof(number));

		memset(ans, 0, sizeof(ans));

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.5836213114465028x):
#include <iostream>

#include <vector>

using namespace std;



vector <int> num, rec;



int main() {

	int n;

	cin >> n;

	num.resize(n + 1);

	rec.resize(n + 1);

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

		cin >> num[i];

		rec[i] = 0;

	}

	

	vector <int> ans;

	for(int i = n; i > 0; --i) {

		int sum = 0;

		int j = 2 * i;

		while(j <= n) {

			sum += rec[j];

			j += i;

		}

		if(sum % 2 != num[i]) {

			rec[i] = 1;

			ans.push_back(i);

		}

	}

	

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

	

	for(int i = 0; i < ans.size(); ++i) {

		cout << ans[i] << " ";

	}

}
// 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];

vector<int> test;

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)

    {

        test.clear();

        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--){

            p=mark[i];

            x=0;

            if(p%2 != ara[i]) ++x,++ct,test.pb(i);

            if(x>0){

                int sq=sqrt(i);

                for(j=1;j<=sq;j++){

                    if(i%j==0){

                        ++mark[j];

                        if(j*j != i) ++mark[i/j];

                    }

                }

            }

        }

        reverse(test.begin(),test.end());

        cout<<ct<<endl;

        if(test.size()>0){

        for(auto xx: test) cout<<xx<<" ";

        cout<<endl;

        }

      

        

    }











}

// Faster C++ solution for the same problem (measured speedup: 1.7991671488388525x):
#include <bits/stdc++.h>

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

#define endl '\n'

#define N 200000 + 5

#define ll long long int

using namespace std;



int n, a[N], b[N];



int main(){

    IOS;

    cin >> n;

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

        cin >> a[i];

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

        int sum = 0;

        for(int j=i+i; j<=n; j+=i){

            sum += b[j];

            sum %= 2;

        }

        b[i] = sum ^ a[i];

    }

    vector<int> ans; // index

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

        if(b[i])

            ans.push_back(i);

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

    for(int i=0; i<ans.size(); i++)

        cout << ans[i] << " ";

    cout << endl;

    return 0;

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

#define maxn 200005

using namespace std;



int arr[maxn], box[maxn];

vector<int> ans;

int n;



int main() {

    scanf("%d", &n);

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

        scanf("%d", arr + i);

    }

    ans.clear();

    memset(box, 0, sizeof(box));

    for(int i = n; i > 0; i--) {

        int sum = 0;

        for(int j = i + i; j <= n; j += i) {

            sum += box[j];

        }

        if(sum % 2 != arr[i]) box[i] = 1;

        if(box[i]) ans.push_back(i);

    }

    printf("%d\n", (int)ans.size());

    for(int i = 0; i < (int)ans.size(); i++) {

        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7721691271605184x):
#include <bits/stdc++.h>

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

#define endl '\n'

#define N 200000 + 5

#define ll long long int

using namespace std;



int n, a[N], b[N];



int main(){

    IOS;

    cin >> n;

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

        cin >> a[i];

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

        int sum = 0;

        for(int j=i+i; j<=n; j+=i){

            sum += b[j];

            sum %= 2;

        }

        b[i] = sum ^ a[i];

    }

    vector<int> ans; // index

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

        if(b[i])

            ans.push_back(i);

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

    for(int i=0; i<ans.size(); i++)

        cout << ans[i] << " ";

    cout << endl;

    return 0;

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

#define MAX_N 200000 + 1

using namespace std;



int N, number[MAX_N], ans[MAX_N];



bool check(){

	for(int i = 1; i <= N; i++){

		int cnt = 0;

		for(int j = i; j <= N; j += i)

			cnt += ans[j];

		cnt %= 2;

		if(cnt ^ number[i]) return false;

	}

	return true;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	

	while(cin >> N){

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

			cin >> number[i];

		

		for(int i = N; i > 0; i--){

			int cnt = 0;

			for(int j = i; j <= N; j += i)

				cnt += ans[j];

			cnt %= 2;

			ans[i] = cnt ^ number[i];

		}

		

		if(check()){

			int sum = 0;

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

				if(ans[i]) sum++;

			cout << sum << endl;

			if(sum){

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

					if(ans[i]) cout << i << " ";

				cout << endl;

			}

		}

		else

			cout << -1 << endl;

		

		memset(number, 0, sizeof(number));

		memset(ans, 0, sizeof(ans));

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.5761501770875745x):
#include <bits/stdc++.h>

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

#define endl '\n'

#define N 200000 + 5

#define ll long long int

using namespace std;



int n, a[N], b[N];



int main(){

    IOS;

    cin >> n;

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

        cin >> a[i];

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

        int sum = 0;

        for(int j=i+i; j<=n; j+=i){

            sum += b[j];

            sum %= 2;

        }

        b[i] = sum ^ a[i];

    }

    vector<int> ans; // index

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

        if(b[i])

            ans.push_back(i);

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

    for(int i=0; i<ans.size(); i++)

        cout << ans[i] << " ";

    cout << endl;

    return 0;

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

#define maxn 200005

using namespace std;



int arr[maxn], box[maxn];

vector<int> ans;

int n;



int main() {

    scanf("%d", &n);

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

        scanf("%d", arr + i);

    }

    ans.clear();

    memset(box, 0, sizeof(box));

    for(int i = n; i > 0; i--) {

        int sum = 0;

        for(int j = i + i; j <= n; j += i) {

            sum += box[j];

        }

        if(sum % 2 != arr[i]) box[i] = 1;

        if(box[i]) ans.push_back(i);

    }

    printf("%d\n", (int)ans.size());

    for(int i = 0; i < (int)ans.size(); i++) {

        printf("%d%c", ans[i], " \n"[i == (int)ans.size() - 1]);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7817478242745317x):
#include <bits/stdc++.h>

using namespace std ;







int main(){

    bool v[200100] ;

    int n,z ;

    cin >> n ;

    for(int i=0 ; i<n ; i++){

        cin >> v[i] ;

    }

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

        if(v[i] == 1){

         // here

         z = i +1 ;

             for (int j=1; j<=sqrt(z); j++)

                {

                    if (z%j == 0)

                    {

                        // If divisors are equal, print only one

                        if (z/j == j)

                            //printf("%d ", i);

                            v[j-1] = -1*(v[j-1]) +1 ;



                        else {

                             v[j-1] = -1*(v[j-1]) +1 ;

                             v[(z/j)-1] = -1*(v[(z/j)-1]) +1 ;

                        }// Otherwise print both

                            //printf("%d %d ", i, n/i);

                    }

                }



          // end

          v[i] = 1 ;

        }







    }

    int ans =0 ;

    for(int i=0 ; i<n ; i++){

        if(v[i] == 1){

            ans ++ ;

        }

    }

    cout << ans << endl ;

    if(ans != 0){

        for(int i=0 ; i<n ; i++){

            if(v[i] == 1){

                cout << i+1 << " " ;

            }

        }

    }



    return 0 ;

}