#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[int(2e5+5)], now[int(2e5+5)];
vector <int> ans;

int main(){
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> A[i];

  for (int i = N; i >= 1; i--){
    if (now[i] % 2 == A[i]) continue;
    ans.push_back(i);
    for (int j = 1; j * j <= i; j++){
      if (i % j != 0) continue;
      now[j]++;
      if (j * j != i) now[i/j]++;
    }
  }

  if (now[1] % 2 != A[1]){
    cout << -1 << endl;
    return 0;
  }

  int M = ans.size();
  cout << M << endl;
  if (M > 0){
    cout << ans[0];
    for (int i = 1; i < M; i++) cout << " " << ans[i];
    cout << endl;
  }

  return 0;
}

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//




int main() {

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

    int b[N+1]; rep(i,N+1) b[i] = -1;
    vector<int> ans;
    for (int i = N; i >= 1; --i) {
        int j = 2;
        int sum = 0;
        while (i*j <= N) {
            sum += b[i*j];
            ++j;
        }
        b[i] = (a[i] + sum) % 2;
        if (b[i] == 1) ans.push_back(i);
    }


    cout << ans.size() << endl;
    rep(i,ans.size()) cout << ans[i] << " ";
    cout << endl;

    return 0;
}



