N = int(eval(input()))

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

M = 0

b = [0]*N

B = []

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

    wa = 0

    cnt = 1

    while i*cnt <= N:

        wa += b[i*cnt-1]

        cnt+=1

    if wa%2 != a[i-1]:

        M+=1

        b[i-1] = 1

        B.append(i)

print(M)

if M!=0:

    print((*B))
N = int(eval(input()))

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

M = 0

b = [0]*N

B = []

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

    wa = sum(b[i-1::i])

    if wa%2 != a[i-1]:

        M+=1

        b[i-1] = 1

        B.append(i)

print(M)

if M!=0:

    print((*B))
N = int(eval(input()))
a = list(map(int, input().split()))
M = 0
b = [0] * N
B = []
for i in range(N, 0, -1):
    wa = 0
    cnt = 1
    while i * cnt <= N:
        wa += b[i * cnt - 1]
        cnt += 1
    if wa % 2 != a[i - 1]:
        M += 1
        b[i - 1] = 1
        B.append(i)
print(M)
if M != 0:
    print((*B))

N = int(eval(input()))
a = list(map(int, input().split()))
M = 0
b = [0] * N
B = []
for i in range(N, 0, -1):
    wa = sum(b[i - 1 :: i])
    if wa % 2 != a[i - 1]:
        M += 1
        b[i - 1] = 1
        B.append(i)
print(M)
if M != 0:
    print((*B))

-    wa = 0 -    cnt = 1 -    while i * cnt <= N: -        wa += b[i * cnt - 1] -        cnt += 1 +    wa = sum(b[i - 1 :: i])