N = int(eval(input()))

*A, = list(map(int,input().split()))

D = [0]*(N+1)

ans = []

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

    if D[i]%2 != A[i-1]:

        ans.append(i)

        for j in range(1,int(i**0.5)+1):

            if i%j==0:

                D[j] += 1

                if i//j != j:D[i//j] += 1

print((len(ans)))

print((*ans))
def get_divisor(n):

    if n==1:return [1]

    a = [1]

    b = [n]

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

        if n%i==0:

            a.append(i)

            b.append(n//i)

    if a[-1]==b[-1]:b.pop()

    a.extend(b[::-1])

    return a



N = int(eval(input()))

*A, = list(map(int,input().split()))

D = [0]*(N+1)

ans = []

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

    if D[i]%2 != A[i-1]:

        ans.append(i)

        for j in get_divisor(i):

            D[j]+=1

print((len(ans)))

print((*ans))
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
D = [0] * (N + 1)
ans = []
for i in range(N, 0, -1):
    if D[i] % 2 != A[i - 1]:
        ans.append(i)
        for j in range(1, int(i**0.5) + 1):
            if i % j == 0:
                D[j] += 1
                if i // j != j:
                    D[i // j] += 1
print((len(ans)))
print((*ans))

def get_divisor(n):
    if n == 1:
        return [1]
    a = [1]
    b = [n]
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            a.append(i)
            b.append(n // i)
    if a[-1] == b[-1]:
        b.pop()
    a.extend(b[::-1])
    return a


N = int(eval(input()))
(*A,) = list(map(int, input().split()))
D = [0] * (N + 1)
ans = []
for i in range(N, 0, -1):
    if D[i] % 2 != A[i - 1]:
        ans.append(i)
        for j in get_divisor(i):
            D[j] += 1
print((len(ans)))
print((*ans))

+def get_divisor(n): +    if n == 1: +        return [1] +    a = [1] +    b = [n] +    for i in range(2, int(n**0.5) + 1): +        if n % i == 0: +            a.append(i) +            b.append(n // i) +    if a[-1] == b[-1]: +        b.pop() +    a.extend(b[::-1]) +    return a + + -        for j in range(1, int(i**0.5) + 1): -            if i % j == 0: -                D[j] += 1 -                if i // j != j: -                    D[i // j] += 1 +        for j in get_divisor(i): +            D[j] += 1