//#include <bits/stdc++.h>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
// constexpr int INF = 1<<30;
// constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

/**
 * PrimeTools class provides functions dealing with primes, calculating primes
 * upto N in advance.
 *
 * Note that when you only deal with factors, N <- sqrt(N) would be enough.
 */
class PrimeTools {
  const ll N;
  vll primes;

  void eratosthenesPrimes(const ll N)
  {
    vll tmp(N+1, 1);
    tmp[0] = 0;
    tmp[1] = 0;
    tmp[2] = 1;

    if (N<=1) return;
    primes.push_back(2);
    if (N<=2) return;

    for(ll i=3; i<=N; i+=2) {
      if (tmp[i] == 0) continue;
      primes.push_back(i);
      if (N<i*i) continue;
      for (ll k=i+i; k<=N; k+=i) {
        tmp[k]=0;
      }
    }
  }

public:

  PrimeTools(const ll _N=10000000)
    : N(_N) {

    eratosthenesPrimes(N);
  }

  typedef typename vll::iterator iterator;
  typedef typename vll::const_iterator const_iterator;

  inline iterator begin() noexcept { return primes.begin(); };
  inline const_iterator cbegin() const noexcept { return primes.cbegin(); };
  inline iterator end() noexcept { return primes.end(); };
  inline const_iterator cend() const noexcept { return primes.cend(); };

  bool isPrime(const ll n) const {
    return binary_search(cbegin(), cend(), n);
  }

  // A return set
  // * does not include 1
  // * includes n
  //
  // 2 -> {2}
  // 6 -> {2, 3}
  // 16 -> {2}  // uniqueなもののみ
  //
  // 約数を知りたい場合は、divisors()
  sll uniqueFactors(ll n) const {
    sll ret;
    if (n==1) return ret;

    const auto itend = upper_bound(cbegin(), cend(), sqrt(n));

    for (auto it = primes.begin(); it!=itend; it++) {
      const ll p = *it;
      if (n==1) break;
      if (n % p == 0) {
        ret.insert(p);
        while (n % p == 0) {
          n /= p;
        }
      }
    }
    if (n>1) ret.insert(n);
    return ret;
  }

  map<ll,ll> factorExponents(ll n) const {
    map<ll, ll> ret;
    if (n==1) return ret;

    for (const ll p : uniqueFactors(n)) {
      if (n % p == 0) {
        ret.insert(make_pair(p,0));
        while (n % p == 0) {
          n /= p;
          ret[p] += 1;
        }
      }
    }
    if (ret.empty()) ret.insert(make_pair(n,1)); // n is prime
    return ret;
  }

  /*
   * Rutuns a vector of sorted products of b^0, b^1, ... , b^n"
   */
  static vll makeProducts(const ll base, const ll n) {
    vll ret;
    ret.reserve(n+1);
    ret.push_back(1);
    for (ll i=1; i<=n; ++i) {
      ret.push_back(ret.back()*base);
    }
    return ret;
  }

  /*
   * Returns a sorted sequence of divisors of n.
   * For example, 12 => (1 2 3 4 6 12)"
   */
  vll divisors(long n) const {
    vll ret;
    ret.push_back(1);
    for (const auto& kv : factorExponents(n)) {
      const vll products = makeProducts(kv.first, kv.second);
      vll tmp;
      tmp.reserve(ret.size()*products.size());
      for (const ll x : ret) {
        for (const ll y : products) {
          tmp.push_back(x*y);
        }
      }
      ret.swap(tmp);
    }
    std::sort(ret.begin(), ret.end());
    return ret;
  }

};
// ========== end of template ==========
//constexpr int N_MAX = 2e5;
int N;
PrimeTools prime;


int main(int argc, char** argv) {
  cin >> N;
  vi A(N+1); // 1-indexed
  for (int i=1; i<=N; i++) {
    cin >> A[i];
  }

  vi ret(N+1, 0);
  vi sum(N+1, 0);

  for (int i=N; i>=1; i--) {
    if (A[i] == sum[i]) {
      // Do not put a ball here
      continue;
    }

    ret[i] = 1;
    for (int d : prime.divisors(i)) {
      if (d==i) continue;
      sum[d] = (sum[d] + 1)%2;
    }
  }

  int M = accumulate(begin(ret), end(ret), 0);
  cout << M << endl;

  if (M==0) {
    return 0;
  }
  for (int i=1; i<=N; i++) {
    if (ret[i]==0) continue;

    cout << i;
    M--;
    cout << (M==0 ? endl : " ");
  }

  return 0;
}


Measured memory_bytes: 88684