#include <bits/stdc++.h>
#pragma once

#include <algorithm>
#include <vector>
#include <unordered_map>

std::vector<bool> is_primes;
std::vector<unsigned int> primes;

using namespace std;

void set_is_primes(unsigned int n) {
	//sieve_of_eratosthenes
	//is_primes : [0, n] �̔z��ŁCprimes[i] = true iff i �͑f��
	//O(n log n)
	is_primes.assign(n + 1, true);
	for (unsigned int i = 0; i <= min((unsigned int)1, n); ++i)
		is_primes[i] = false;
	for (unsigned int i = 2; i*i <= n; ++i)
		if (is_primes[i])
			for (unsigned int j = i * i; j <= n; j += i)
				is_primes[j] = false;
	return;
}

void set_primes(unsigned int n) {
	//sieve_of_eratosthenes
	//primes : n�ȉ��̑f���̃��X�g
	//O(n log n)
	primes.assign(n + 1, 0);
	for (unsigned int i = 2; i <= min((unsigned int)1, n); ++i) primes[i] = i;
	for (unsigned int i = 2; i*i <= n; ++i)
		if (primes[i])
			for (unsigned int j = i * i; j <= n; j += i)
				primes[j] = 0;
	primes.erase(remove(primes.begin(), primes.end(), 0), primes.end());
	return;
}

vector<bool> make_is_prime_segments(unsigned long long L, unsigned long long H) {
	//��Ԃӂ邢
	//is_primes : [L, H] �̔z��ŁCprimes[i] = true iff i �͑f��
	//O((H-L) sqrt( H ) / log(H))
	vector<bool> is_prime_segments(H - L + 1, true);
	for (int i = 0; (unsigned long long)primes[i] * primes[i] <= H; ++i) { // O( \sqrt(H) )
		unsigned long long j;
		if (primes[i] >= L)          j = primes[i] * primes[i];
		else if (L % primes[i] == 0) j = L;
		else                         j = L - (L % primes[i]) + primes[i];
		for (; j <= H; j += primes[i]) is_prime_segments[j - L] = false;
	}
	return is_prime_segments;
}

bool is_prime(const int n, const bool is_using_is_primes) {
	if (n <= 1)
		return false;
	for (int i = 2; i*i <= n; i++) {
		if (is_using_is_primes && !is_primes[i])
			continue;
		if (n % i == 0)
			return false;
	}
	return true;
}

vector<unsigned int> make_divisors(const unsigned int n) {
	vector<unsigned int> ans;
	for (unsigned int i = 1; i*i <= n; i++)
		if (n%i == 0)
			ans.emplace_back(i);
	vector<unsigned int> latter;
	const auto rit_b = ans.crbegin();
	const bool is_square = (*rit_b * *rit_b == n);
	for (auto rit = rit_b + (is_square ? 1 : 0), rit_e = ans.crend(); rit != rit_e; rit++)
		latter.emplace_back(n / *rit);
	ans.insert(ans.end(), latter.begin(), latter.end());
	return ans;
}

vector<unsigned long long> make_divisors(const unsigned long long n) {
	vector<unsigned long long> ans;
	for (unsigned long long i = 1; i*i <= n; i++)
		if (n%i == 0)
			ans.emplace_back(i);
	vector<unsigned long long> latter;
	const auto rit_b = ans.crbegin();
	const bool is_square = (*rit_b * *rit_b == n);
	for (auto rit = rit_b + (is_square ? 1 : 0), rit_e = ans.crend(); rit != rit_e; rit++)
		latter.emplace_back(n / *rit);
	ans.insert(ans.end(), latter.begin(), latter.end());
	return ans;
}

unordered_map<unsigned int, unsigned int> make_prime_factors(unsigned int n, const bool is_using_primes) {
	//O(sqrt(n))
	unordered_map<unsigned int, unsigned int> prime_factors;
	for (unsigned int i = 2; i*i <= n; i++) {
		if (is_using_primes && !is_primes[i])
			continue;
		while (n % i == 0) {
			++prime_factors[i];
			n /= i;
		}
	}
	if (n != 1)
		++prime_factors[n];
	return prime_factors;
}

unordered_map<unsigned long long, unsigned long long> make_prime_factors(unsigned long long n, const bool is_using_primes) {
	//O(sqrt(n))
	unordered_map<unsigned long long, unsigned long long> prime_factors;
	for (unsigned long long i = 2; i*i <= n; i++) {
		if (is_using_primes && !is_primes[i])
			continue;
		while (n % i == 0) {
			++prime_factors[i];
			n /= i;
		}
	}
	if (n != 1)
		++prime_factors[n];
	return prime_factors;
}

using namespace std;

using pii = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N + 1);
    for (int i = 1; i <= N; i++)
        cin >> a[i];

    vector<int> s(N + 1, 0);
    vector<int> b;
    for (int i = N; i >= 1; i--)
    {
        if (s[i] % 2 != a[i])
        {
            b.push_back(i);
            vector<unsigned int> divisorsOfi = make_divisors((unsigned int)i);
            for (const auto n : divisorsOfi)
                s[n]++;
        }
    }
    int M = b.size();

    cout << M << endl;
    for (int j = 0; j < M; j++)
    {
        cout << b[j] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3064