import std.stdio, std.string, std.conv;

int[] factors(int x) {
    import std.numeric;
    int[] result = [1];
    while (x % 2 == 0) {
        x /= 2;
        if (result[$-1] != 2) result ~= 2;
    }
    for (int i = 3; i * i <= x; i += 2) {
        while (x % i == 0) {
            x /= i;
            if (result[$-1] != i) result ~= i;
        }
    }
    if (x != 1) result ~= x;
    return result;
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);
    int[] b;
    foreach_reverse (i; 0 .. n) {
        if (a[i]) {
            b ~= i + 1;
            int[] tmp = factors(i+1);
            foreach (x; tmp) {
                a[x-1] = !a[x-1];
            }
        }
    }
    b.length.writeln;
    if (b.length) b.to!(string[]).join(" ").writeln;
}