N = int(eval(input()))

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

b = [0] * N

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

    sum = 0

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

        sum += b[j-1]

    if sum % 2 == 0:

        b[i-1] = a[i-1]

    else:

        b[i-1] = 1 - a[i-1]

count = b.count(1)

print((b.count(1)))

if count > 0:

    ans = ''

    for i in range(1, N+1):

        if b[i-1] == 1:

            ans += str(i) + ' '

    print((ans[:-1]))

N = int(eval(input()))

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

b = []

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

    s = sum(a[j] for j in range(i*2, N+1, i))

    if s % 2 == 1:

        a[i] = 1 - a[i]

    if a[i]:

        b.append(i)

print((len(b)))

if len(b) > 0:

    print((*b))

N = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * N
for i in range(N, 0, -1):
    sum = 0
    for j in range(i * 2, N + 1, i):
        sum += b[j - 1]
    if sum % 2 == 0:
        b[i - 1] = a[i - 1]
    else:
        b[i - 1] = 1 - a[i - 1]
count = b.count(1)
print((b.count(1)))
if count > 0:
    ans = ""
    for i in range(1, N + 1):
        if b[i - 1] == 1:
            ans += str(i) + " "
    print((ans[:-1]))

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

-a = list(map(int, input().split())) -b = [0] * N -for i in range(N, 0, -1): -    sum = 0 -    for j in range(i * 2, N + 1, i): -        sum += b[j - 1] -    if sum % 2 == 0: -        b[i - 1] = a[i - 1] -    else: -        b[i - 1] = 1 - a[i - 1] -count = b.count(1) -print((b.count(1))) -if count > 0: -    ans = "" -    for i in range(1, N + 1): -        if b[i - 1] == 1: -            ans += str(i) + " " -    print((ans[:-1])) +a = [0] + list(map(int, input().split())) +b = [] +for i in range(1, N + 1)[::-1]: +    s = sum(a[j] for j in range(i * 2, N + 1, i)) +    if s % 2 == 1: +        a[i] = 1 - a[i] +    if a[i]: +        b.append(i) +print((len(b))) +if len(b) > 0: +    print((*b))