#include <bits/stdc++.h>
int main() {
  int n, a[300000] = {}, m = 0, b[300000] = {}, c[300000] = {}, t;
  std::vector<int> p;
  std::cin >> n;
  for (int i = 1; i < n + 1; ++i) {
    std::cin >> a[i];
    c[i] = 1;
  }
  for (int i = 2; i < std::sqrt(n) + 1; ++i) {
    if (c[i]) {
      for (int j = 2; i * j < n + 1; ++j) {
        c[i * j] = 0;
      }
    }
  }
  for (int i = 2; i < n + 1; ++i) {
    if (c[i]) p.push_back(i);
  }
  for (int i = n; i > 0; --i) {
    t = 0;
    for (int j = 0; j < p.size(); ++j) {
      if (i * p[j] > n) break;
      if (a[i * p[j]] == 1) t = (t + 1) % 2;
    }
    if (a[i] != t) {
      b[m] = i;
      ++m;
    }
  }
  std::cout << m << "\n";
  for (int i = 0; i < m; ++i) std::cout << b[i] << " ";
}
