n = int(input())

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

val = [0] * n



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

    if n // i == 1:

        val[i - 1] = lis[i - 1]

    else:

        p = n // i

        a = 0

        for j in range(p):

            a += val[i * (j + 1) - 1]

        if a % 2 == lis[i - 1]:

            val[i - 1] = 0

        else:

            val[i - 1] = 1



t = sum(val) % 2

if lis[0] == t:

    print(sum(val))

    print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ")

else:

    print(-1)

    

n = int(input())

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

val = [0] * n



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

    if n // i == 1:

        val[i - 1] = lis[i - 1]

    else:

        a = sum(val[i - 1::i])

        if a % 2 == lis[i - 1]:

            val[i - 1] = 0

        else:

            val[i - 1] = 1



print(sum(val))

print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ")

n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
    if n // i == 1:
        val[i - 1] = lis[i - 1]
    else:
        p = n // i
        a = 0
        for j in range(p):
            a += val[i * (j + 1) - 1]
        if a % 2 == lis[i - 1]:
            val[i - 1] = 0
        else:
            val[i - 1] = 1
t = sum(val) % 2
if lis[0] == t:
    print(sum(val))
    print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ")
else:
    print(-1)

n = int(input())
lis = list(map(int, input().split()))
val = [0] * n
for i in range(n, 0, -1):
    if n // i == 1:
        val[i - 1] = lis[i - 1]
    else:
        a = sum(val[i - 1 :: i])
        if a % 2 == lis[i - 1]:
            val[i - 1] = 0
        else:
            val[i - 1] = 1
print(sum(val))
print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ")

-        p = n // i -        a = 0 -        for j in range(p): -            a += val[i * (j + 1) - 1] +        a = sum(val[i - 1 :: i]) -t = sum(val) % 2 -if lis[0] == t: -    print(sum(val)) -    print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ") -else: -    print(-1) +print(sum(val)) +print(*[i + 1 for i in range(n) if val[i] == 1], sep=" ")