import sys

input = sys.stdin.readline



def main():

    N = int(eval(input()))

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

    lst = b[:]

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

        j = i

        a = 0

        while j <=N: a, j = a^lst[j-1], j+i

        lst[i-1] = a

    ans = [i+1 for i in range(N) if lst[i]]

    print((len(ans)))

    print((*ans))

    



if __name__ == '__main__':

    main()
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)

import sys

def main(N, A):

    A = [-1] + A

    B = [0] * (N + 1)

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

        xor = 0

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

            xor ^= B[j]

        B[i] = xor ^ A[i]

    print((sum(B)))

    print((*[i for i, b in enumerate(B) if b == 1]))



if __name__ == '__main__':

    input = sys.stdin.readline

    N = int(eval(input()))

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

    main(N, A)

import sys

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    b = list(map(int, input().split()))
    lst = b[:]
    for i in range(N, 0, -1):
        j = i
        a = 0
        while j <= N:
            a, j = a ^ lst[j - 1], j + i
        lst[i - 1] = a
    ans = [i + 1 for i in range(N) if lst[i]]
    print((len(ans)))
    print((*ans))


if __name__ == "__main__":
    main()

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys


def main(N, A):
    A = [-1] + A
    B = [0] * (N + 1)
    for i in range(N, 0, -1):
        xor = 0
        for j in range(i * 2, N + 1, i):
            xor ^= B[j]
        B[i] = xor ^ A[i]
    print((sum(B)))
    print((*[i for i, b in enumerate(B) if b == 1]))


if __name__ == "__main__":
    input = sys.stdin.readline
    N = int(eval(input()))
    (*A,) = list(map(int, input().split()))
    main(N, A)

+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) -input = sys.stdin.readline - -def main(): -    N = int(eval(input())) -    b = list(map(int, input().split())) -    lst = b[:] +def main(N, A): +    A = [-1] + A +    B = [0] * (N + 1) -        j = i -        a = 0 -        while j <= N: -            a, j = a ^ lst[j - 1], j + i -        lst[i - 1] = a -    ans = [i + 1 for i in range(N) if lst[i]] -    print((len(ans))) -    print((*ans)) +        xor = 0 +        for j in range(i * 2, N + 1, i): +            xor ^= B[j] +        B[i] = xor ^ A[i] +    print((sum(B))) +    print((*[i for i, b in enumerate(B) if b == 1])) -    main() +    input = sys.stdin.readline +    N = int(eval(input())) +    (*A,) = list(map(int, input().split())) +    main(N, A)