from collections import Counter



N,*a = map(int,open(0).read().split())

ans = []

for i in range(N)[::-1]:

    part_rem = sum(a[i::i+1]) % 2

    if a[i] == 0:

        if part_rem == 1:

            a[i] = abs(a[i] - 1) 

    elif a[i] == 1:

        if part_rem == 0:

            a[i] = abs(a[i] - 1)

            

c = Counter(a)            

print(c[1])

for i in range(N):

    if a[i] == 1:

        print(i+1,end=" ")

print()        

      

    

N,*a = list(map(int,open(0).read().split()))

ans = []

for i in range(N)[::-1]:

    part_rem = sum(a[i::i+1]) % 2

    if a[i] != part_rem:

        a[i] = abs(a[i] - 1) 



print((sum(a)))

print((*[i+1 for i,v in enumerate(a) if v == 1]))
from collections import Counter

N, *a = map(int, open(0).read().split())
ans = []
for i in range(N)[::-1]:
    part_rem = sum(a[i :: i + 1]) % 2
    if a[i] == 0:
        if part_rem == 1:
            a[i] = abs(a[i] - 1)
    elif a[i] == 1:
        if part_rem == 0:
            a[i] = abs(a[i] - 1)
c = Counter(a)
print(c[1])
for i in range(N):
    if a[i] == 1:
        print(i + 1, end=" ")
print()

N, *a = list(map(int, open(0).read().split()))
ans = []
for i in range(N)[::-1]:
    part_rem = sum(a[i :: i + 1]) % 2
    if a[i] != part_rem:
        a[i] = abs(a[i] - 1)
print((sum(a)))
print((*[i + 1 for i, v in enumerate(a) if v == 1]))

-from collections import Counter - -N, *a = map(int, open(0).read().split()) +N, *a = list(map(int, open(0).read().split())) -    if a[i] == 0: -        if part_rem == 1: -            a[i] = abs(a[i] - 1) -    elif a[i] == 1: -        if part_rem == 0: -            a[i] = abs(a[i] - 1) -c = Counter(a) -print(c[1]) -for i in range(N): -    if a[i] == 1: -        print(i + 1, end=" ") -print() +    if a[i] != part_rem: +        a[i] = abs(a[i] - 1) +print((sum(a))) +print((*[i + 1 for i, v in enumerate(a) if v == 1]))