#include <bits/stdc++.h>
using namespace std;
int ans, a[200000 + 5], b[200000 + 5];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; i--) {
    int k = i, tmp = 0, flag = 0, wei = 0;
    for (int j = i; j <= n; j += k) {
      if (b[j] == 1) {
        tmp++;
      } else if (b[j] == 0 && flag == 0) {
        wei = j;
        flag = 1;
      }
    }
    tmp %= 2;
    if (tmp != a[i]) {
      if (wei == 0) {
        cout << -1 << endl;
        return 0;
      }
      b[wei] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] == 1) {
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (b[i] == 1) {
      cout << i << ' ';
    }
  }
}
