n = int(eval(input()))

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

aaa = [0] + aaa

for i in range(n // 2, 0, -1):

    b = 0

    j = i * 2

    while n >= j:

        b ^= aaa[j]

        j += i

    aaa[i] ^= b



ans = [i for i, b in enumerate(aaa) if b]

print((len(ans)))

print((*ans))

n = int(eval(input()))

a = [0] + list(map(int, input().split()))

for i in range(n // 2, 0, -1):

    a[i] = sum(a[i::i]) % 2



s = [i for i, b in enumerate(a) if b]

print((len(s)))

print((*s))

n = int(eval(input()))
aaa = list(map(int, input().split()))
aaa = [0] + aaa
for i in range(n // 2, 0, -1):
    b = 0
    j = i * 2
    while n >= j:
        b ^= aaa[j]
        j += i
    aaa[i] ^= b
ans = [i for i, b in enumerate(aaa) if b]
print((len(ans)))
print((*ans))

n = int(eval(input()))
a = [0] + list(map(int, input().split()))
for i in range(n // 2, 0, -1):
    a[i] = sum(a[i::i]) % 2
s = [i for i, b in enumerate(a) if b]
print((len(s)))
print((*s))

-aaa = list(map(int, input().split())) -aaa = [0] + aaa +a = [0] + list(map(int, input().split())) -    b = 0 -    j = i * 2 -    while n >= j: -        b ^= aaa[j] -        j += i -    aaa[i] ^= b -ans = [i for i, b in enumerate(aaa) if b] -print((len(ans))) -print((*ans)) +    a[i] = sum(a[i::i]) % 2 +s = [i for i, b in enumerate(a) if b] +print((len(s))) +print((*s))