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

b = [0]*(n+1)

for x in range(n,0,-1):

	b[x] = (sum(b[x::x])+a[x-1])%2

print(b.count(1))

for i in range(n+1):

	if b[i]:

		print(i,end=" ")

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

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

print(a.count(1));print(*[i+1 for i in range(n)if a[i]],end=" ")

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

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

-b = [0] * (n + 1) -for x in range(n, 0, -1): -    b[x] = (sum(b[x::x]) + a[x - 1]) % 2 -print(b.count(1)) -for i in range(n + 1): -    if b[i]: -        print(i, end=" ") +for x in range(n - 1, 0, -1): +    a[x - 1] = (sum(a[x * 2 - 1 :: x]) + a[x - 1]) % 2 +print(a.count(1)) +print(*[i + 1 for i in range(n) if a[i]], end=" ")