#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
vector<int> factor(int x) {
    vector<int> ret;
    int y = x;
    for (int i = 1; i * i <= y; i++) {
        if (y % i == 0) {
            ret.push_back(i);
            if (i * i != y) ret.push_back(y / i);
        }
    }
    return ret;
}
/* main */
int main(){
    int N;
    cin >> N;
    vector<int> a(N+1);
    for (int i = 1; i <= N; i++) cin >> a[i];

    vector<int> cnt(N+1, 0);
    vector<int> ball;
    for (int i = N; i >= 1; i--) {
        if ((cnt[i] % 2) == a[i]) continue;
        ball.push_back(i);
        vector<int> factors = factor(i);
        for (int f : factors) cnt[f]++;
    }

    reverse(ball.begin(), ball.end());
    int M = ball.size();
    cout << M << '\n';
    for (int i = 0; i < ball.size(); i++) {
        if (i) cout << ' ';
        cout << ball[i];
    }
    cout << '\n';
}
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}
signed main() {
  int n;
  int ans=0;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  vector<int>ball(n);
  for(int i=n-1;i>=0;i--){
    int p=i+1;
    int count=0;
    while(p<=n){
      if(ball[p-1])count++;
      p+=i+1;
    }
    ball[i]=abs((count%2)-a[i]);
    if(ball[i]) ans++;
  }
  cout<<ans<<endl;
  rep(i,n){
    if(ball[i])cout<<i+1<<endl;
  }
}
