N=int(eval(input()))

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

A=[0]+A

B=[0]*(N+1)

#print(A)



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

  tmp=0

  for j in range(2,N//i+1):

    if B[i*j]: tmp+=1

  B[i]=(A[i]+tmp)%2

  

#print(B)

C=[]

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

  if B[i]: C.append(i)

#print(C)



print((len(C)))

if len(C): print((*C))
M = int(eval(input()))

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



B = [0] * (M + 1)



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

  j = 2

  tmp = 0

  while i * j <= M:

    B[i] += B[i * j]

    j += 1

  B[i] += A[i]

  B[i] %= 2

  

answer = []

for i in range(M + 1):

  if B[i]:

    answer.append(i)



if len(answer):

  print((len(answer)))

  print((*answer))

else:

  print((0))
N = int(eval(input()))
A = list(map(int, input().split()))
A = [0] + A
B = [0] * (N + 1)
# print(A)
for i in range(N, 0, -1):
    tmp = 0
    for j in range(2, N // i + 1):
        if B[i * j]:
            tmp += 1
    B[i] = (A[i] + tmp) % 2
# print(B)
C = []
for i in range(1, N + 1):
    if B[i]:
        C.append(i)
# print(C)
print((len(C)))
if len(C):
    print((*C))

M = int(eval(input()))
A = [0] + list(map(int, input().split()))
B = [0] * (M + 1)
for i in range(M, 0, -1):
    j = 2
    tmp = 0
    while i * j <= M:
        B[i] += B[i * j]
        j += 1
    B[i] += A[i]
    B[i] %= 2
answer = []
for i in range(M + 1):
    if B[i]:
        answer.append(i)
if len(answer):
    print((len(answer)))
    print((*answer))
else:
    print((0))

-N = int(eval(input())) -A = list(map(int, input().split())) -A = [0] + A -B = [0] * (N + 1) -# print(A) -for i in range(N, 0, -1): +M = int(eval(input())) +A = [0] + list(map(int, input().split())) +B = [0] * (M + 1) +for i in range(M, 0, -1): +    j = 2 -    for j in range(2, N // i + 1): -        if B[i * j]: -            tmp += 1 -    B[i] = (A[i] + tmp) % 2 -# print(B) -C = [] -for i in range(1, N + 1): +    while i * j <= M: +        B[i] += B[i * j] +        j += 1 +    B[i] += A[i] +    B[i] %= 2 +answer = [] +for i in range(M + 1): -        C.append(i) -# print(C) -print((len(C))) -if len(C): -    print((*C)) +        answer.append(i) +if len(answer): +    print((len(answer))) +    print((*answer)) +else: +    print((0))