stablegradients/pie-gem5-pairs huggingface dataset:
// 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.823276229590491x):
#include<iostream>

using namespace std;

int ans,a[200000+5],b[200000+5];

int main(){

	int n;

	cin>>n;

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

		cin>>a[i];

	}

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

		int k=i,tmp=0,flag=0,wei=0;

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

	    	if(b[j]==1){

	    		tmp++;

			}

			else if (b[j]==0&&flag==0){

				wei=j;

				flag=1;

			}

			

		}

		tmp%=2;

			if(tmp!=a[i]){

				if(wei==0){

					cout<<-1<<endl;

					return 0;

				} 

				b[wei]=1;

				//cout<<i<<endl;

			}

	}

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

		if(b[i]==1){

			ans++;

		}

	}

	cout<<ans<<endl;

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

		if(b[i]==1){

			cout<<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];

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.8288528023053376x):
#include<bits/stdc++.h>

#define ll long long

#define S second

#define F first



using namespace std;



const int N = 2e5 + 5, M = 2 * N;



int arr[N], b[N];



int main()

{

    vector<int> v;

    int n;

    scanf("%d", &n);

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

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

    {

        int sum = 0;

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

        {

            sum += b[j];

        }

        if((sum&1) != arr[i]) b[i] = 1, v.emplace_back(i);

    }

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

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



    return 0;

}
// Slower C++ solution:
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

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

typedef long long ll;

using namespace std;

const int N = 2e5 + 5;

int main() {

    abdelrahman010

    int n , a[N];

    cin >> n;

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

        cin >> a[i];

    vector<int> v;

    int cnt[N] = {};

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

        if (a[i]) {

            int c = 0;

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

                c += cnt[j];

            if (c % 2 == 0) {

                v.push_back(i);

                cnt[i]++;

            }

        } else {

            int c = 0;

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

                c += cnt[j];

            if (c % 2) {

                v.push_back(i);

                cnt[i]++;

            }

        }

    }

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

    for(auto &i : v)

        cout << i << " ";

    return 0;

}

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

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



#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;

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

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n;

int a[N],b[N]={0};

int main(){

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

	cin>>n;

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

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

    b[i] = a[i];

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

      b[i] ^= b[j];

  }

  int cnt = 0;

  for (int i = 1; i <= n; ++i) if (b[i] == 1) cnt++;

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

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

    if (b[i] == 1) printf("%d ", i);

}

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

int a[300008],b[2000008];

int main(){

    int n,t=0;

    scanf("%d",&n);

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

        scanf("%d",a+i),b[i]=0;

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

          int   s=b[i];

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

            s+=b[i*j];

        }

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

            s++;

            t++;

            b[i]=1;

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

                printf("-1\n");

                return 0;

            }

        }

    }

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

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

        if(b[i]){

            printf("%d ",i);

        }

    }

    printf("\n");

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

using namespace std;



const int N = 400003;

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



vector <int> ans;



signed main(void)

{

	//后面影像前面 

	scanf("%d", &n);

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

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

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

	{

		int res = 0;

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

			res+=b[j];

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

		 b[i] = 1;

	ans.push_back(i);

	}

	}	

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

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

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

	return 0;

}

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

int a[300008],b[2000008];

int main(){

    int n,t=0;

    scanf("%d",&n);

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

        scanf("%d",a+i),b[i]=0;

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

          int   s=b[i];

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

            s+=b[i*j];

        }

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

            s++;

            t++;

            b[i]=1;

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

                printf("-1\n");

                return 0;

            }

        }

    }

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

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

        if(b[i]){

            printf("%d ",i);

        }

    }

    printf("\n");

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

#define me(a,x) memset(a,x,sizeof(a))

#define sc scanf

#define itn int

using namespace std;

const int N=1e6;

const long long mod=1e9+7;

const int oo=0x7fffffff;

const int sup=0x80000000;

typedef long long ll;

typedef unsigned long long ull;

template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}

template <typename it>

string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}

template <typename it>int o(it a){cout<<a<<endl;return 0;}

ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}

ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}

int n;

int a[N],b[N]={0};

int main(){

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

	cin>>n;

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

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

    b[i] = a[i];

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

      b[i] ^= b[j];

  }

  int cnt = 0;

  for (int i = 1; i <= n; ++i) if (b[i] == 1) cnt++;

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

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

    if (b[i] == 1) printf("%d ", i);

}

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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

using namespace std;



const int N = 400003;

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



vector <int> ans;



signed main(void)

{

	//后面影像前面 

	scanf("%d", &n);

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

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

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

	{

		int res = 0;

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

			res+=b[j];

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

		 b[i] = 1;

	ans.push_back(i);

	}

	}	

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

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

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

	return 0;

}

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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

using namespace std;

const int maxn=2e5+10;

const int mod=1e6+3;

typedef long long ll;

#define inf 0x3f3f3f3f

#define mem(a,b) memset(a,b,sizeof(a))

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

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

#define pi acos(-1.0)

#define mid ((l+r)>>1)

#define lson rt<<1,l,mid

#define rson rt<<1|1,mid+1,r

#define qwq puts("QWQ");

void read(int &x)

{

	int f=1;x=0;

	char ch=getchar();

	while(ch<'0'||ch>'9')

	{

		if(ch=='-')f=-1;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

	x*=f;

}

int a[maxn],b[maxn];

int main()

{

   int n;read(n);

   rep(i,1,n)read(a[i]);

   int i,j,ans=0;

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

   {

   	   int sum=0;

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

   	   {

   	   	 sum+=b[j];

   	   }

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

   	   {

   	   	  b[i]=1;ans++;

   	   }

   }

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

   rep(i,1,n)

   {

   	if(b[i])printf("%d ",i);

   }

}

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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

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

using namespace std;



int main(){

	IOS;

	int n;

	cin >> n;

	vector<int> num(n+1);

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

	vector<int> cnt(n+1,0),ans;

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

		if(num[i]==0){

			if(cnt[i]%2==1){

				ans.push_back(i);

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

					if(i%j==0){

						cnt[j]++;

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

					}

				}

			}

		}

		else{

			if(cnt[i]%2==0){

				ans.push_back(i);

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

					if(i%j==0){

						cnt[j]++;

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

					}

				}

			}

		}

	}

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

	for(int f:ans) cout << f << ' ';

	cout << '\n';

	return 0;

}


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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

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

#define endl '\n'

#define N 200000 + 5

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] << (i == ans.size()-1 ? "\n" : " ");

    return 0;

}


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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

using namespace std;





int main ()

{

    int n;

    cin>>n;

    int a[n+1];

    bool b[n+1]= {false};



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

    {

        cin>>a[i];

    }

    int s;

    int m=0;

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

    {

        s=0;

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

        {

            if(b[j]==true)

                s++;

        }

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

        {

            b[i]=true;

            m++;

        }



    }

    cout<<m<<endl;

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

    {

        if (b[i]==true)



            cout<<i<<" ";

    }

    cout<<endl;



    return 0;

}


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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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



using namespace std;



#ifdef NeverBeRed

#include "debug.h"

#else

#define debug(...) 9715

#endif

typedef long long ll;

typedef long double ld;

typedef complex<ll> point;

#define F first

#define S second







int main()

{

	#ifdef TurnRed

		//freopen("a.in", "r", stdin);

		//freopen("a.out", "w", stdout);

	#endif



	ios_base::sync_with_stdio(0), cin.tie(0);



	int n;

	cin >> n;

	vector<int> a(n), b(n+1);

	for (auto &i : a) cin >> i;



	a.insert(a.begin(), 0);

	vector<int> ans;

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

	{

		int s = 0;

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

			s ^= b[j];

		if (s != a[i])

		{

			b[i] = 1;

			ans.push_back(i);

		}

	}



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

	for (auto &i : ans)

		cout << i << " \n"[&i==&ans.back()];



	return 0;

}


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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

#define F first

#define S second

using namespace std;

typedef long long ll;

typedef pair<ll, ll>pll;

const int N = 2e5 + 5;

ll n, arr[N];

int main()

{

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;

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

        cin >> arr[i];

    vector<ll>ans;

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

    {

        arr[i] %= 2;

        if(arr[i])

        {

            ans.push_back(i);

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

            {

                if(i % j == 0)

                {

                    arr[j]++;

                    if(j != i / j)

                        arr[i / j]++;

                }

            }

        }

    }

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

    for(auto &it : ans)

        cout << it << ' ';

    return 0;

}


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

#include<math.h>

int main()

{

	int n,an=0;

	scanf("%d",&n);

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

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

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

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

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

		{

			c[an++]=i;

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

				if(i%j==0)

				{

					b[j-1]=!b[j-1];

					b[i/j-1]=!b[i/j-1];

				}

			int t=sqrt(i);

			if(t*t==i)

				b[t-1]=!b[t-1];

		}

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

	for(int i=an-1;i>=0;i--)

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

	return 0;

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

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N;

	cin >> N;

	int A[200001];

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



	vector<int> kotae;

	int B[200001] = {};

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

		if (A[i] != B[i]) {

			cesp(i);

			cesp(A[i]);

			ce(B[i]);

			kotae.pb(i);

			int rt = sqrt(i);

			rep1(j, rt) {

				if (i % j == 0) {

					B[j] ^= 1;

					if(i != j * j) B[i / j] ^= 1;

				}

			}

		}

	}

	co(kotae.size());

	rep1(i, kotae.size()) {

		cosp(kotae[kotae.size() - i]);

	}



	Would you please return 0;

}

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

#include<cstdio>

#include<algorithm>

using namespace std;

typedef long long ll;

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

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



const int dm = 1 << 21;

char dn[dm], * di = dn;

inline void putint(int X) {

	int keta = 0;

	char C[10];

	while (X) {

		*(C + keta) = '0' + X % 10;

		X /= 10;

		keta++;

	}

	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));

	*di++ = '\n';

}

bool b[200001];

int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);





	char c;

	int N = 0;

	while ((c = getchar_unlocked()) >= '0') N = N * 10 + c - '0';



	bool a[200001];

	rep1(i, N) {

		a[i] = getchar_unlocked() - '0';

		getchar_unlocked();

	}



	int kazu = 0;

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

		bool k = a[i];

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

			k ^= b[j];

		}

		if (k) {

			kazu++;

			b[i] = true;

		}

	}

	if (kazu == 0) {

		*di++ = '0';

		*di++ = '\n';

	}

	else putint(kazu);

	rep1(i, N) {

		if (b[i]) putint(i);

	}

	fwrite(dn, 1, di - dn, stdout);



	Would you please return 0;

}