#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9 + 100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  ll n;
  cin >> n;
  vector<int> a(n + 1, 0);
  for (int i = (1); i < (n + 1); i++) cin >> a[i];
  vector<int> ans(n + 1, 0);
  ll m = 0;
  for (ll i = n; i >= 1; i--) {
    ll k = i;
    ll flag = 0;
    while (k <= n) {
      flag += ans[k];
      k += k;
    }
    flag = flag % 2;
    if (flag != a[i]) {
      ans[i] = 1;
      m++;
    }
  }
  cout << m << endl;
  for (int i = (1); i < (n + 1); i++) {
    if (ans[i] > 0) cout << i << " ";
  }
  cout << endl;
  return 0;
}
