n,*a=list(map(int,open(0).read().split()))

b=[0]*-~n

for i in range(n,0,-1):b[i]=(sum(b[j]for j in range(i,n+1,i))+a[i-1])%2

c=[i for i in range(n+1)if b[i]]

print((len(c),*c))
n,*a=list(map(int,open(0).read().split()))

for i in range(n,0,-1):a[i-1]=sum(a[i-1::i])%2

print((sum(a),*[i+1for i in range(n)if a[i]]))
n, *a = list(map(int, open(0).read().split()))
b = [0] * -~n
for i in range(n, 0, -1):
    b[i] = (sum(b[j] for j in range(i, n + 1, i)) + a[i - 1]) % 2
c = [i for i in range(n + 1) if b[i]]
print((len(c), *c))

n, *a = list(map(int, open(0).read().split()))
for i in range(n, 0, -1):
    a[i - 1] = sum(a[i - 1 :: i]) % 2
print((sum(a), *[i + 1 for i in range(n) if a[i]]))

-b = [0] * -~n -    b[i] = (sum(b[j] for j in range(i, n + 1, i)) + a[i - 1]) % 2 -c = [i for i in range(n + 1) if b[i]] -print((len(c), *c)) +    a[i - 1] = sum(a[i - 1 :: i]) % 2 +print((sum(a), *[i + 1 for i in range(n) if a[i]]))