#######################################

import numpy as np

#######################################

n = int(eval(input()))

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

ret = np.zeros(n+1, dtype="int")

tmp = list(range(n+1))

ret2 = []



for i in reversed(list(range(n))): 

  if sum(ret[::i+1][1:])%2 != a[i]:

    ret[i+1] = 1

    ret2.append(i+1)



print((sum(ret[1:])))

print((" ".join(list(map(str, ret2[::-1])))))
n = int(eval(input()))

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

ret = [0]*(n+1)

ret2 = []



for i in reversed(list(range(n))): 

  if sum(ret[::i+1][1:])%2 != a[i]:

    ret[i+1] = 1

    ret2.append(i+1)



print((sum(ret[1:])))

print((" ".join(list(map(str, ret2[::-1])))))
#######################################
import numpy as np

#######################################
n = int(eval(input()))
a = np.array(list(map(int, input().split())))
ret = np.zeros(n + 1, dtype="int")
tmp = list(range(n + 1))
ret2 = []
for i in reversed(list(range(n))):
    if sum(ret[:: i + 1][1:]) % 2 != a[i]:
        ret[i + 1] = 1
        ret2.append(i + 1)
print((sum(ret[1:])))
print((" ".join(list(map(str, ret2[::-1])))))

n = int(eval(input()))
a = list(map(int, input().split()))
ret = [0] * (n + 1)
ret2 = []
for i in reversed(list(range(n))):
    if sum(ret[:: i + 1][1:]) % 2 != a[i]:
        ret[i + 1] = 1
        ret2.append(i + 1)
print((sum(ret[1:])))
print((" ".join(list(map(str, ret2[::-1])))))

-####################################### -import numpy as np - -####################################### -a = np.array(list(map(int, input().split()))) -ret = np.zeros(n + 1, dtype="int") -tmp = list(range(n + 1)) +a = list(map(int, input().split())) +ret = [0] * (n + 1)