import std;
import core.bitop;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "g");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = new long[](n);
    auto c = new long[](n);
    foreach_reverse (i; iota(n).map!"a += 1"())
    {
        if (b[i - 1] != a[i - 1])
        {
            auto t = factorization(i);
            foreach (e; t)
            {
                b[e - 1] = (b[e - 1] + 1) % 2;
            }
            c[i - 1] = 1;
        }
    }

    c.sum.writeln();
    iota(n).filter!(i => c[i] > 0)
        .map!(x => x + 1)
        .map!text
        .join(' ').writeln();
}

auto factorization(long N)
{
    auto f = new long[](0);
    foreach (i; iota(1, N + 1))
    {
        if (i ^^ 2 > N)
            break;

        if (N % i == 0)
        {
            f ~= [i];
            f ~= [N / i];
        }
    }
    return f.sort.uniq.array();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
