#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1234567;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[200005];
signed main() {
    int N;
    cin >> N;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<int>ans;
    for(int i = N; i >= 1; i--) {
        if(cnt[i]%2 == a[i-1]) {
            continue;
        }
        ans.push_back(i);
        for(int j = 1; j*j <= i; j++) {
            if(i%j == 0) {
                if(j*j == i) {
                    cnt[j]++;
                }
                else {
                    cnt[j]++;
                    cnt[i/j]++;
                }
            }
        }
    }
    cout << ans.size() << endl;
    for(int i = 0; i < ans.size(); i++) {
        if(i) {
            cout << " ";
        }
        cout << ans[i];
    }
}

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    int a[n+1];
    rep(i,n) cin >> a[i+1];
    int ans[n+1];
    rep(i,n) ans[i+1] = 0;
    //rep(i,n) cout << a[i] << endl;
    for(int i = n; i >= 1; --i) {
        //printf("OK\n");
        for(int j = i; j <= n; j += i) {
            ans[i] = (ans[i]+ans[j])%2;
        }
        ans[i] = (ans[i]+a[i])%2;
        //printf("OK2\n");
    }
    //rep(i,n) cout << ans[i+1] << endl;
    int cnt = 0;
    rep(i,n) {
        if(ans[i+1]) cnt++;
    }
    if (cnt) {
        cout << cnt << endl;
        rep(i,n) {
            if (ans[i+1]) {
                printf("%d\n", i+1);
            }
        }
    } else cout << 0 << endl;
    return 0;
}
