#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll n; cin >> n;
    vector<ll> a(n); cin >> a;
    vector<ll> b(n, 0);
    ll m = 0;
    for(ll i = n-1; i >= 0; --i){
        if((i+1)*2 > n){
            b[i] = a[i];
        }else{
            ll sum = 0;
            for(ll j = i; j < n; j += (i+1)){
                sum += b[j];
            }
            if(sum%2 == 0 && a[i] == 1) b[i] = 1;
            if(sum%2 == 1 && a[i] == 0) b[i] = 1;
        }
        m += b[i];
    }
    cout << m << endl;
    rep(i, n){
        if(m == 0) continue;
        if(i > 0 && b[i-1]) cout << " ";
        if(b[i]) cout << i+1;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int N; cin >> N;
	vector<int> a(N + 1);
	for(int i = 1; i <= N; i++) cin >> a[i];
	set<int> b;
	for(int i = N; i > 0; i--) {
		int sum = 0;
		for(int j = i + i; j <= N; j += i) {
			if(b.count(j)) sum++;
		}
		if(sum % 2 != a[i]) b.insert(i);
	}
	int M = b.size();
	int cnt = 0;
	cout << M << endl;
	for(auto p: b) {
		cnt++;
		if(cnt == b.size()) {
			cout << p << endl;
			return 0;
		}
		cout << p << " ";
	}
}