#import numpy as np

N = int(input())

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

ans = [0]*(N+1)

an = []

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

  c =0

  b = [i*j for j in range(2,N//i+1)]

  for j in b:

    c +=ans[j]

  c = c%2

  if c!=a[i]:

    ans[i]=1

    an.append(i)

print(len(an))

for i in range(len(an)):

  print(an[i],end=" ")

#import numpy as np

N = int(input())

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

ans = [0]*(N+1)

an = []

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

  c =0

  c = sum(ans[2*i::i])

  if c%2!=a[i]:

    ans[i]=1

    an.append(i)

print(len(an))

for i in range(len(an)):

  print(an[i],end=" ")

# import numpy as np
N = int(input())
a = [0] + list(map(int, input().split()))
ans = [0] * (N + 1)
an = []
for i in range(N, 0, -1):
    c = 0
    b = [i * j for j in range(2, N // i + 1)]
    for j in b:
        c += ans[j]
    c = c % 2
    if c != a[i]:
        ans[i] = 1
        an.append(i)
print(len(an))
for i in range(len(an)):
    print(an[i], end=" ")

# import numpy as np
N = int(input())
a = [0] + list(map(int, input().split()))
ans = [0] * (N + 1)
an = []
for i in range(N, 0, -1):
    c = 0
    c = sum(ans[2 * i :: i])
    if c % 2 != a[i]:
        ans[i] = 1
        an.append(i)
print(len(an))
for i in range(len(an)):
    print(an[i], end=" ")

-    b = [i * j for j in range(2, N // i + 1)] -    for j in b: -        c += ans[j] -    c = c % 2 -    if c != a[i]: +    c = sum(ans[2 * i :: i]) +    if c % 2 != a[i]: