N=int(eval(input()))

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

b=[0]*(N+1)#箱



ans=[]

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

    bit=0

    for j in range(N//i):

        bit+=b[i+j*i]

    bit%=2

    if bit!=a[i-1]:

        b[i]=1

        ans.append(i)



print((sum(b)))

print((' '.join(map(str, ans))))
import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    a=LI()

    b=[0]*N

    

    

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

        temp=0

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

            jj=j-1

            if b[jj]:

                temp+=1

        temp=temp%2

        if temp!=a[i]:

            b[i]=1

            

    M=sum(b)

    ans=[]

    for i in range(N):

        if b[i]:

            ans.append(i+1)

            

    print(M)

    print((' '.join(map(str, ans))))

        



main()

N = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * (N + 1)  # 箱
ans = []
for i in range(N, 0, -1):
    bit = 0
    for j in range(N // i):
        bit += b[i + j * i]
    bit %= 2
    if bit != a[i - 1]:
        b[i] = 1
        ans.append(i)
print((sum(b)))
print((" ".join(map(str, ans))))

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    a = LI()
    b = [0] * N
    for i in range(N - 1, -1, -1):
        temp = 0
        for j in range(i + 1, N + 1, i + 1):
            jj = j - 1
            if b[jj]:
                temp += 1
        temp = temp % 2
        if temp != a[i]:
            b[i] = 1
    M = sum(b)
    ans = []
    for i in range(N):
        if b[i]:
            ans.append(i + 1)
    print(M)
    print((" ".join(map(str, ans))))


main()

-N = int(eval(input())) -a = list(map(int, input().split())) -b = [0] * (N + 1)  # 箱 -ans = [] -for i in range(N, 0, -1): -    bit = 0 -    for j in range(N // i): -        bit += b[i + j * i] -    bit %= 2 -    if bit != a[i - 1]: -        b[i] = 1 -        ans.append(i) -print((sum(b))) -print((" ".join(map(str, ans)))) +import sys + +input = sys.stdin.readline + + +def I(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def main(): +    mod = 10**9 + 7 +    N = I() +    a = LI() +    b = [0] * N +    for i in range(N - 1, -1, -1): +        temp = 0 +        for j in range(i + 1, N + 1, i + 1): +            jj = j - 1 +            if b[jj]: +                temp += 1 +        temp = temp % 2 +        if temp != a[i]: +            b[i] = 1 +    M = sum(b) +    ans = [] +    for i in range(N): +        if b[i]: +            ans.append(i + 1) +    print(M) +    print((" ".join(map(str, ans)))) + + +main()