#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  vi cnt(n);
  for(int i = n-1; 0 <= i; i--){
    int sum = 0;
    for(int j = i; j < n; j += i+1) sum ^= cnt[j];
    cnt[i] = sum^a[i];
  }
  vi ans;
  rep(i,n) if(cnt[i]) ans.push_back(i+1);
  cout << ans.size() << "\n";
  if(ans.size()) for(auto x : ans) cout << x << " ";
  cout << "\n";
  return 0;
}

#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const int mod = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<bool> a(N + 1);

    for (int i = 1; i <= N; i++) {
        int ai;
        cin >> ai;
        if (ai == 1) {
            a[i] = false;
        } else {
            a[i] = true;
        }
    }

    vector<bool> c(N + 1, false); //すくなくとも1つはiの倍数（i自身）があるのでfalse(割ったあまりが1)
    vector<vector<int>> divisor(N + 1);
    for (int i = 1; i <= N; i++) {
        for (int j = 2 * i; j <= N; j += i) {
            divisor[j].push_back(i);
        }
    }

    vector<int> b;
    for (int i = N; i >= 1; i--) {
        if (a[i] == c[i]) {
            b.push_back(i);
            for (int d : divisor[i]) {
                c[d] = !c[d];
            }
        }
    }

    reverse(b.begin(), b.end());
    int M = b.size();
    cout << M << endl;
    rep(i, M)
    {
        printf("%d%c", b[i], i == M - 1 ? '\n' : ' ');
    }

    return 0;
}
