n=int(eval(input()))

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

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

  l[i-1]=sum(l[i-1::i])%2

print((sum(l)))

print((*[i+1 for i in range(n) if l[i]]))
n=int(eval(input()))

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

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

  l[i-1]=sum(l[i-1::i])%2

print((sum(l)))

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

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

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