#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
	int N;
	cin >> N;
	vector<int> a(N + 1), b(N + 1);
	for (int i = 1; i <= N; i++) cin >> a[i];
	for (int i = N; i >= 1; i--){
		int s = 0;
		for (int j = i + i; j <= N; j += i){
			s ^= b[j];
		}
		b[i] = s ^ a[i];
	}
	vector<int> ans;
	for (int i = 1; i <= N; i++){
		if (b[i]) ans.push_back(i);
	}
	cout << ans.size() << endl;
	rep(i, ans.size()){
		cout << ans[i] << " ";
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int N;
  cin >> N;
  
  vector<int>A(N);
  vector<int>B(N,0);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if (i >= N/2){
      B.at(i) = A.at(i);
    }
  }
  
  for (int i = N/2; i > 0; i--) {
    int judge = 0;
    for (int j = 1; j <= N/i; j++) {
      if (B.at(i*j-1) == 1){
        judge++;
      }
    }
    if (judge % 2 != A.at(i-1)){
      B.at(i-1) = 1;
    }
  }
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (B.at(i) == 1){
      count++;
    }
  }
  cout << count << endl;
  for (int i = 0; i < N; i++) {
    if (B.at(i) == 1){
      cout << i+1;
      count--;
      if (count != 0){
        cout << ' ';
      }
    }
  }
  cout << endl;
}
      
    
      
  
  
  
 