import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_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, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto a = aryread();
    auto box = new long[](n);
    foreach_reverse (i; iota(n))
    {
        if (a[i] == box[i])
        {
            continue;
        }
        else
        {
            auto factor = (i + 1).factorization();
            foreach (e; factor)
            {
                box[e - 1] = !box[e - 1];
            }
        }
    }
    box.format_write();
}

auto factorization(long a)
{
    auto factor = new long[](0);
    auto limit = cast(long) sqrt(cast(float) a);
    foreach (i; iota(limit))
    {
        long tmp = i + 1;
        if (a % tmp == 0)
        {
            factor ~= tmp;
            if (tmp != a / tmp)
                factor ~= a / tmp;
        }
    }
    factor.sort();
    return factor;
}

void format_write(T)(T ary)
{
    long len = ary.length - 1;
    while (len >= 0 && ary[len] == 0)
        len--;
    writeln(len + 1);
    if (len > 0)
    {
        foreach (i; iota(len - 1))
            writef("%s ", ary[i]);
        writeln(ary[len]);
    }
}

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