N = int(eval(input()))

As = list(map(int, input().split()))



isBalls = [0] * (N+1)

for k in reversed(list(range(1, N+1))):

    num = sum([isBalls[k*i] for i in range(1, N//k+1)])

    if num % 2 != As[k-1]:

        isBalls[k] = 1



M = sum(isBalls)

anss = [i for i in range(1, N+1) if isBalls[i] > 0]



print(M)

print((' '.join(map(str, anss))))

N = int(eval(input()))

As = list(map(int, input().split()))



Bs = [0] * (N+1)

for i in reversed(list(range(1, N+1))):

    parity = sum(Bs[i::i]) % 2

    if parity != As[i-1]:

        Bs[i] = 1



anss = [i for i in range(1, N+1) if Bs[i]]



print((len(anss)))

if anss:

    print((' '.join(map(str, anss))))

N = int(eval(input()))
As = list(map(int, input().split()))
isBalls = [0] * (N + 1)
for k in reversed(list(range(1, N + 1))):
    num = sum([isBalls[k * i] for i in range(1, N // k + 1)])
    if num % 2 != As[k - 1]:
        isBalls[k] = 1
M = sum(isBalls)
anss = [i for i in range(1, N + 1) if isBalls[i] > 0]
print(M)
print((" ".join(map(str, anss))))

N = int(eval(input()))
As = list(map(int, input().split()))
Bs = [0] * (N + 1)
for i in reversed(list(range(1, N + 1))):
    parity = sum(Bs[i::i]) % 2
    if parity != As[i - 1]:
        Bs[i] = 1
anss = [i for i in range(1, N + 1) if Bs[i]]
print((len(anss)))
if anss:
    print((" ".join(map(str, anss))))

-isBalls = [0] * (N + 1) -for k in reversed(list(range(1, N + 1))): -    num = sum([isBalls[k * i] for i in range(1, N // k + 1)]) -    if num % 2 != As[k - 1]: -        isBalls[k] = 1 -M = sum(isBalls) -anss = [i for i in range(1, N + 1) if isBalls[i] > 0] -print(M) -print((" ".join(map(str, anss)))) +Bs = [0] * (N + 1) +for i in reversed(list(range(1, N + 1))): +    parity = sum(Bs[i::i]) % 2 +    if parity != As[i - 1]: +        Bs[i] = 1 +anss = [i for i in range(1, N + 1) if Bs[i]] +print((len(anss))) +if anss: +    print((" ".join(map(str, anss))))