n = int(eval(input()))

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

b = [None]*n

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

    s = 0

    for j in range(2*i, n+1, i):

        s += b[j-1]

    b[i-1] = a[i-1]^(s%2)

print((sum(b)))

print((*[ind+1 for ind, i in enumerate(b) if i]))

n = int(eval(input()))

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

balls = [0]*(n+1)

ans = []



for ind, i in enumerate(reversed(a)):

    ind = n-ind

    tmp = i

    for j in range(ind*2, n+1, ind):

        tmp += balls[j]

    balls[ind] = tmp%2

    if tmp%2==1:

        ans.append(ind)

print((len(ans)))

print((*ans))
n = int(eval(input()))
a = list(map(int, input().split()))
b = [None] * n
for i in range(n, 0, -1):
    s = 0
    for j in range(2 * i, n + 1, i):
        s += b[j - 1]
    b[i - 1] = a[i - 1] ^ (s % 2)
print((sum(b)))
print((*[ind + 1 for ind, i in enumerate(b) if i]))

n = int(eval(input()))
a = list(map(int, input().split()))
balls = [0] * (n + 1)
ans = []
for ind, i in enumerate(reversed(a)):
    ind = n - ind
    tmp = i
    for j in range(ind * 2, n + 1, ind):
        tmp += balls[j]
    balls[ind] = tmp % 2
    if tmp % 2 == 1:
        ans.append(ind)
print((len(ans)))
print((*ans))

-b = [None] * n -for i in range(n, 0, -1): -    s = 0 -    for j in range(2 * i, n + 1, i): -        s += b[j - 1] -    b[i - 1] = a[i - 1] ^ (s % 2) -print((sum(b))) -print((*[ind + 1 for ind, i in enumerate(b) if i])) +balls = [0] * (n + 1) +ans = [] +for ind, i in enumerate(reversed(a)): +    ind = n - ind +    tmp = i +    for j in range(ind * 2, n + 1, ind): +        tmp += balls[j] +    balls[ind] = tmp % 2 +    if tmp % 2 == 1: +        ans.append(ind) +print((len(ans))) +print((*ans))