#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  vector<ll> a(N + 1); rep1(i, N) cin >> a[i];
  vector<ll> b(N + 1, 0);
  
  ll ans = 0;
  bool ok = true;

  for(ll i = N; i > 0; i--) {
    ll cnt = 0;
    for(ll j = i; j <= N; j += i) {
      cnt += b[j]; 
    }
    b[i] = (cnt + a[i]) % 2 ;
    //    cerr << i << "]" << cnt << "->" << b[i] << endl;
    ans += b[i];
  }
  cout << ans << endl;
  if(ans > 0) {
    rep1(i, N) {
      if(b[i] == 1) cout << i << " " ;
    }
    cout << endl;
  }



}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

vector<ll> enum_divisors(ll n){
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0){
            res.push_back(i);
            if (n/i != i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<int> sum(n+1, 0);
    vector<int> num(n+1, -1);
    vector<int> res;
    for (int i = n-1; i >= 0; --i) {
        int tmp;
        if (sum[i+1] % 2 != a[i]) {
            tmp = 1;
        } else {
            tmp = 0;
        }

        if (num[i+1] != -1 && num[i+1] != tmp) {
            cout << -1 << endl;
            return 0;
        }
        num[i+1] = tmp;
        if (tmp == 1) {
            res.push_back(i+1);
            auto V = enum_divisors(i+1);
            for (auto v : V) {
                sum[v]++;
            }
        }
    }
    cout << res.size() << endl;
    for (auto v : res) {
        cout << v << endl;
    }
}