stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<vector>

#define MAX 200000

using namespace std;

typedef long long ll;

vector<ll> divisor(ll n) {

  vector<ll> ret;

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

    if(n % i == 0) {

      ret.push_back(i);

      if(i * i != n) ret.push_back(n / i);

    }

  }

  return (ret);

}

int main(){

  int n,m=0;

  cin >> n;

  vector<int> a(n);

  ll n_list[MAX+2]={};

  bool add[MAX+2]={};

  bool can=true;

  ll num=0;

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

    cin >> a[i];

  }

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

    if(n_list[i]%2!=a[i-1]){

      m++;

      add[i]=true;

      vector<ll> div = divisor(i);

      for(int j=0;j<div.size();j++){

        n_list[div[j]]++;

      }

    }

  }

  cout << m <<endl;

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

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

  }

  if(m!=0) cout << endl;

}


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

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

signed main(){

  ll n,cnt=0,v;

  cin >> n;

  ll a[n],b[n],val[n];

  fill(b,b+n,0);

  fill(val,val+n,0);

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

    cin >> a[i];

  }

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

    v=0;

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

      v+=b[j-1];

    }

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

      b[i]++;

      cnt++;

    }

  }

  cout << cnt<<endl;

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

    if(b[i]==1){

      cout << i+1<<" ";

    }

  }

  if(cnt>0){

    cout << endl;

  }

}
// Slower C++ solution:
#define mod 1000000007

#define PI acos(-1)

#include<time.h>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<map>

#include<queue>

#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x7fffffffffffffff;

const int inf=0x7fffffff;

const int N=2e5+5;

clock_t start,finish;

void time_in(){start=clock();}

void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}

inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}

inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}

inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}

inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();

	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}

inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}

int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};

int st[4][2]={1,0,0,1,-1,0,0,-1};

int t,cas;

int n,m,k;

int main()

{

	int a[N];

	int sum[N];

	int ans[N];

	while(~scanf("%d",&n))

	{

		int cnt=0;

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

		{

			scanf("%d",&a[i]);

			sum[i]=0;

		}

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

		{

			if(sum[i]%2!=a[i])

			{

				ans[cnt++]=i;

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

				{

					if(i%j==0)

					{

						sum[j]++;

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

					}

				}

			}

		}

		sort(ans,ans+cnt);

		printf("%d\n",cnt);

		for(int i=0;i<cnt;i++)

		{

			printf("%d",ans[i]);

			printf(i==cnt-1?"\n":" ");

		}

	}

}


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

#include <vector>

using namespace std;



#define PB push_back



constexpr int kN = int(2E5 + 10);



int a[kN];



int main() {

	int n;

	vector<int> v;

	scanf("%d", &n);

	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	for (int i = n; i >= 1; i--) for (int j = i << 1; j <= n; j += i) a[i] ^= a[j];

	for (int i = 1; i <= n; i++) if (a[i]) v.PB(i);

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

	if (!v.empty()) printf("%d", v[0]);

	for (int i = 1; i < int(v.size()); i++) printf(" %d", v[i]);

	printf("\n");

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

#define int long long



using namespace std;



int n, arr[200001], cnt[200001];



signed main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(0);



    cin >> n;

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

        cin >> arr[i];



    vector<int> ans;

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

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

        {

            ans.push_back(i);

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

                if (j * j == i)

                    cnt[j]++;

                else if (i % j == 0)

                    cnt[j]++, cnt[i / j]++;

                else;

        }

    cout << ans.size() << '\n';

    for (int i : ans)

        cout << i << ' ';

    cout << '\n';



    return 0;

}

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

#include <vector>

using namespace std;



#define PB push_back



constexpr int kN = int(2E5 + 10);



int a[kN];



int main() {

	int n;

	vector<int> v;

	scanf("%d", &n);

	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	for (int i = n; i >= 1; i--) for (int j = i << 1; j <= n; j += i) a[i] ^= a[j];

	for (int i = 1; i <= n; i++) if (a[i]) v.PB(i);

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

	if (!v.empty()) printf("%d", v[0]);

	for (int i = 1; i < int(v.size()); i++) printf(" %d", v[i]);

	printf("\n");

}
// Slower C++ solution:
#define mod 1000000007

#define PI acos(-1)

#include<time.h>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<map>

#include<queue>

#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

const ll INF=0x7fffffffffffffff;

const int inf=0x7fffffff;

const int N=2e5+5;

clock_t start,finish;

void time_in(){start=clock();}

void time_out(){finish=clock();double tim=(double)(finish-start)/CLOCKS_PER_SEC;printf("Running time is %lf\n",tim);}

inline ll mul(ll a,ll b){ll s=0;while(b){if(b&1)s=(s+a)%mod;a=(a<<1)%mod;b>>=1;}return s%mod;}

inline ll pow_mul(ll a,ll b){ll s=1;while(b){if(b&1)s=mul(s,a);a=mul(a,a);b>>=1;}return s;}

inline ll poww(ll a,ll b){ll s=1;while(b){if(b&1)s=(s*a)%mod;a=(a*a)%mod;b>>=1;}return s%mod;}

inline bool read(int &ret){char c=getchar();int sgn;if(c==EOF)return 0;while(c!='-'&&(c<'0'||c>'9'))c=getchar();

	sgn=((c=='-')?-1:1);ret=((c=='-')?0:(c-'0'));while(c=getchar(),c>='0'&&c<='9')ret=ret*10+(c-'0');ret*=sgn;return 1;}

inline void write(int x){if(x>9)write(x/10);putchar(x%10+'0');}

int fact[10]={1,1,2,6,24,120,720,5040,40320,362880};

int st[4][2]={1,0,0,1,-1,0,0,-1};

int t,cas;

int n,m,k;

int main()

{

	int a[N];

	int sum[N];

	int ans[N];

	while(~scanf("%d",&n))

	{

		int cnt=0;

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

		{

			scanf("%d",&a[i]);

			sum[i]=0;

		}

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

		{

			if(sum[i]%2!=a[i])

			{

				ans[cnt++]=i;

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

				{

					if(i%j==0)

					{

						sum[j]++;

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

					}

				}

			}

		}

		sort(ans,ans+cnt);

		printf("%d\n",cnt);

		for(int i=0;i<cnt;i++)

		{

			printf("%d",ans[i]);

			printf(i==cnt-1?"\n":" ");

		}

	}

}


// Faster C++ solution for the same problem (measured speedup: 5.427895013016443x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

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



using namespace std;



const int N = 2e5 + 5;

int arr[N], v[N];



int main() {

    //freopen("in.txt", "rt", stdin);

    int n;

    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) scanf("%d", arr + i);

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

        int z = 0;

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

            z ^= v[j];

        }

        if (z != arr[i]) v[i] = 1;

    }

    vector<int> ans;

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

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

    }

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

    for (auto x:ans) printf("%d ", x);

}

// Faster C++ solution for the same problem (measured speedup: 5.192428586819054x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

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

#define int long long



using namespace std;



int n, arr[200001], cnt[200001];



signed main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(0);



    cin >> n;

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

        cin >> arr[i];



    vector<int> ans;

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

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

        {

            ans.push_back(i);

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

                if (j * j == i)

                    cnt[j]++;

                else if (i % j == 0)

                    cnt[j]++, cnt[i / j]++;

                else;

        }

    cout << ans.size() << '\n';

    for (int i : ans)

        cout << i << ' ';

    cout << '\n';



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.326063078468722x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

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

#include <vector>

using namespace std;



#define PB push_back



constexpr int kN = int(2E5 + 10);



int a[kN];



int main() {

	int n;

	vector<int> v;

	scanf("%d", &n);

	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	for (int i = n; i >= 1; i--) for (int j = i << 1; j <= n; j += i) a[i] ^= a[j];

	for (int i = 1; i <= n; i++) if (a[i]) v.PB(i);

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

	if (!v.empty()) printf("%d", v[0]);

	for (int i = 1; i < int(v.size()); i++) printf(" %d", v[i]);

	printf("\n");

}


// Faster C++ solution for the same problem (measured speedup: 4.822271468364632x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

}
// Slower C++ solution:
//

//  main.cpp

//  pL L - Preparing Boxes

//

//  Created by Hsiu-Fen Chou on 2019/12/20.

//  Copyright © 2019 Hsiu-Fen Chou. All rights reserved.

//



#include <iostream>

#include <cstring>

#include <vector>

using namespace std;

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



int main() {

    TURBO

    int N;

    cin >> N;

    int a[N+1], b[N+1];

    

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

    

    memset(b, 0, sizeof(b));

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

        int cnt = 0;

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

            if (b[j] == 1) cnt ^= 1;

        }

        if (cnt ^ a[i]) b[i] = 1;

    }

    vector<int> v;

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

        if (b[i]) v.push_back(i);

    }

    cout << v.size() << '\n';

    for (auto i: v) cout << i << ' ';

    cout << '\n';

    

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3278466133931355x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

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

using namespace std;

typedef long long ll;

#define F first

#define S second

bool b[200005]={0};

bool a[200005]={0};

int main()

{

    int n;

    cin>>n;

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

        cin>>a[i];

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

    {

        if(b[i]!=a[i])

        {

            b[i]=1;

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

            {

                if(i%j==0)

                {

                    a[j]=!a[j];

                    if(j==i/j) continue;

                    a[i/j]=!a[i/j];

                }

            }

        }



    }

    int cnt=0;

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

    {

        if(b[i]) cnt++;

    }

    cout<<cnt<<'\n';

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

    {

        if(b[i]) cout<<i<<' ';

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.204231555865271x):
//l

#include<stdio.h>



int n, a[200005], b[200005]={0}, c[200005], idx=0;



int main()

{

	scanf("%d", &n);

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

	{

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

	}

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

	{

		int tmp=0;

		for(int j=2; j*i<=n; j++) tmp+=b[i*j], tmp&=1;

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

		if(b[i]) c[idx++]=i;

	}

	printf("%d\n", idx);

	if(idx)

	{

		printf("%d", c[0]);

		for(int i=1; i<idx; i++) printf(" %d", c[i]);

		puts("");

	}

	return 0;

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

using namespace std;

typedef long long ll;

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

#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)

#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)

#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)



/*

上から順に決めれそう

*/



bool ok=true;

ll n,a[200010],b[200010];

vector<ll> fact[200010],ans;



void factoring(ll n,vector<ll> v[]){

	ll visit[300010]={};

	reg(i,2,n){

		if(visit[i]==0){

			reg(j,1,n){

				if(j*i>n)break;

				visit[i*j]=1;

				v[i*j].push_back(i);//素因数リスト（重複は含まず）

			}

		}

	}

}



void init(){

	cin>>n;

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

	// factoring(n,fact);

}



int main(void){

	init();

	ireg(i,1,n){

		if(a[i]==1){

			ans.push_back(i);

			reg(j,1,i){

				if(j*j>i)break;

				if(i%j!=0)continue;

				if(j==i/j){

					a[j]=1-a[j];

				}else{

					a[j]=1-a[j];

					a[i/j]=1-a[i/j];

				}

			}

		}

	}

	ireg(i,1,n)if(a[i]==1)ok=false;

	if(ok){

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

		rep(i,ans.size())cout<<ans[i]<<" ";

		cout<<endl;

	}else{

		cout<<-1<<endl;

	}

	return 0;

}

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

using namespace std;

typedef long long ll;

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

#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)

#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)

#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)



/*

上から順に決めれる

O(NlogN)版

*/



bool ok=true;

ll n,a[200010];

vector<ll> ans;



void init(){

	cin>>n;

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

}



int main(void){

	init();

	ireg(i,1,n){

		for(int j=2;i*j<=n;j++)a[i]^=a[j*i];

		if(a[i]==1){

			ans.push_back(i);

		}

	}

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

	rep(i,ans.size())cout<<ans[i]<<" ";

	cout<<endl;

	return 0;

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

using namespace std;

int main() {

	int n;

	cin >> n;

	int a[n+1]={};

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

		cin >> a[i];

	}

	int m=0;

	int cnt = 0;

	int b[200010]={};

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

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

			cnt += b[j];

		}

		cnt%=2;

		if(a[i]!=cnt){

			b[i] = 1;

			m++;

		}

		cnt = 0;

	}

	cout << m << endl;

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

		if(b[i]) cout << i << endl;

	}

}

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

using namespace std;

int x[200000];

int z[200000];

int len=0;

int main()

{

    int n,i,s=0,mark;

    scanf("%d",&n);

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

    {

        scanf("%d",&x[i]);

    }

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

    {

        s=0;

        mark=i;

        while(mark<=n)

        {

            s+=z[mark];

            mark+=i;

        }

        if(s%2!=x[i])

        {

            z[i]=1;

            len++;

        }

    }

    printf("%d\n",len);

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

        if(z[i])

        printf("%d ",i);

    printf("\n");

    return 0;

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

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

#define irep(i,a,b) for(ll i=ll(a);i>ll(b);i--)

using ll = long long;

using namespace std;



ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

//sort(a, a + N, greater<ll>())   // descend

//sort(a, a+N)                    //  ascend



/* 

void comb(vector<vector <ll> > &v) {

	ll mod=1000000007;

	rep (i,0,v.size()) {

		v[i][0] = 1;

		v[i][i] = 1;

	}

	rep (k,1,v.size()) {

		rep (j,1,k) {

			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;

		}

	}

}

/*main内でnCn~nC0 生成 **

vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));

comb(v);

*/





int main(){

	ll n;

	cin>>n;

	ll a[220000];

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

	ll b[220000]={0};

	ll cnt=0;

	ll m=0;

	irep(i,n,0){

		for(ll j=i;j<=n;j+=i)cnt+=b[j];	

		cnt=cnt%2;

		if(a[i]!=cnt){b[i]=1;m++;}

		cnt=0;

	}

	cout<<m<<endl;

	rep(i,1,n+1) if(b[i]==1)cout<<i<<endl;

}










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

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

#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)

#define pb push_back

#define mp make_pair

#define pll pair<ll,ll>

#define endl "\n"

using ll=long long;

using ld=long double;

using namespace std;

ll mod= 1e9+7;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }



ll a[210000];

ll b[210000];

main(){

    ll n,ans=0;

    cin>>n;

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

    irep(i,n,1){

      ll tmp=0;

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

        if(b[j]==1)tmp++;

      }

      if(tmp%2!=a[i]){b[i]=1;ans++;}

    }

    cout<<ans<<endl;

    rep(i,1,n+1){

      if(b[i]==1)cout<<i<<endl;

    }

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

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

#define rrep(i, n) for (int i = n - 1; i >= 0; i--)

using namespace std;

using Graph = vector<vector<int>>;

typedef long long ll;

typedef pair<int,int> P;



int main(){

    int n;

    cin >> n;

    int a[n], b[200010] = {}, ans = 0;

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



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

        int tmp = j, cnt = 0;

        while (tmp <= n){

            cnt += b[tmp];

            tmp += j;

        }

        b[j] = (a[j - 1] + cnt) % 2;

        if(b[j] != 0) ans ++;

    }



    cout << ans << endl;



    if (ans == 0) return 0;



    rep(i, n + 1) if (b[i] == 1) cout << i << " ";

    cout << endl;

    return 0;

}

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

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

#define rrep(i, n) for (int i = n - 1; i >= 0; i--)

using namespace std;

#define INF ((1<<30)-1)

#define LINF (1LL<<60)

#define EPS (1e-10)

typedef long long ll;

typedef pair<ll, ll> P;

const int MOD = 1000000007;

const int MOD2 = 998244353;



int a[200010];

int b[200010];



int main(){

    int n;

    cin >> n;

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



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

        b[i] = a[i];

    }



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

        int tmp = 0;

        for(int i = 2 * k; i <= n; i += k){

            tmp += b[i];

        }

        tmp += a[k];

        if (tmp%2 == 0) b[k] = 0;

        else b[k] = 1;

    }



    int cnt = 0;

    rep(i, n) cnt += b[i+1];

    cout << cnt << endl;

    if (cnt == 0) return 0;

    rep(i, n) if (b[i+1] > 0) cout << i+1 << " ";

    cout << endl;



    return 0;

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

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

#define REPR(i, n) for(int i = n; i >= 0; i--)

#define FOR(i, m, n) for(int i = m; i < n; i++)

#define FORR(i ,m, n) for(int i = m; i >= n; i--)

#define pb(a) push_back(a)

#define mk(a,b) make_pair(a,b)

#define ll long long

#define INF 999999999

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

using namespace std;

typedef pair<int, int> P;

typedef pair<int, P> PP;

typedef pair<ll,ll> LP;

typedef pair<ll,LP> LPP;



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

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

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}

int lcm(int a,int b){return a/gcd(a,b)*b;}



int main() {

    

    int N; cin >> N;

    vector<int> T; vector<int> b; int count=0;

    vector<int> A(200020);

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

        int a; cin >> a;

        T.push_back(a);

    }

    

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

        if(T[i]==A[i+1]%2);

        else{

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

                if((i+1)%j==0){

                    A[j]++;

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

                }

            }

            b.push_back(i+1); count++;

        }

    }

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

    cout << count << endl;

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

    cout << b[i] << " " << flush;

    if(b.size()!=0)cout << endl;



    return 0;

}


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

#include <string>

#include <algorithm>

#include <vector>

#include <iomanip>

#include <math.h>

#include <complex>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <unordered_map>

#include <set>

#include <bitset>

#include <functional>

#include <assert.h>

using ll=long long;

#define int ll

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

#define rep(i,b) rng(i,0,b)

#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)

#define per(i,b) gnr(i,0,b)

#define eb emplace_back

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

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

#define fi first

#define se second

const int INF = 1e15;

using namespace std;



template<class T> using vc=vector<T>;

template<class T> using vvc=vc<vc<T>>;



using pi=pair<int,int>;

using vi=vc<int>;



template<class T>

inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}

template<class T>

inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}



signed main() {

    cin.tie(0);

    ios::sync_with_stdio(0);

    cout<<fixed<<setprecision(20);



    int N; cin >> N;

    int A[N];

    rep(i,N) cin >> A[i];

    int B[N];

    vi ans;

    per(i,N){

        int cnt=0;

        int pos=2*(i+1);

        while(N>=pos){

            cnt+=B[pos-1];

            pos+=i+1;

        }

        cnt%=2;

        B[i]=cnt^A[i];

        if(cnt^A[i]) ans.eb(i+1);

    }

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

    for(auto a:ans){

        cout << a << " ";

    }

    cout << endl;



}