def main():

    N = int(eval(input()))

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



    B = [0] * (N+1)



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

        tmp = 0

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

            tmp ^= B[j]

        B[i] = tmp ^ A[i]



    cnt = 0

    ans = []

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

        if B[i] == 1:

            cnt += 1

            ans.append(i)



    print(cnt)

    print((*ans))



main()
def main():

    N = int(eval(input()))

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

    B = [0] * (N+1)

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

        tmp = 0

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

            tmp += B[j]

        B[i] = (tmp % 2) ^ A[i]



    ans = []

    for i in range(N+1):

        if B[i] != 0:

            ans.append(i)



    print((len(ans)))

    print((*ans))







if __name__ == "__main__":

    main()
def main():
    N = int(eval(input()))
    A = [0] + list(map(int, input().split()))
    B = [0] * (N + 1)
    for i in range(N, 0, -1):
        tmp = 0
        for j in range(i, N + 1, i):
            tmp ^= B[j]
        B[i] = tmp ^ A[i]
    cnt = 0
    ans = []
    for i in range(1, N + 1):
        if B[i] == 1:
            cnt += 1
            ans.append(i)
    print(cnt)
    print((*ans))


main()

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


if __name__ == "__main__":
    main()

-            tmp ^= B[j] -        B[i] = tmp ^ A[i] -    cnt = 0 +            tmp += B[j] +        B[i] = (tmp % 2) ^ A[i] -    for i in range(1, N + 1): -        if B[i] == 1: -            cnt += 1 +    for i in range(N + 1): +        if B[i] != 0: -    print(cnt) +    print((len(ans))) -main() +if __name__ == "__main__": +    main()