from sys import stdin



def main():

    input = stdin.readline

    n = int(eval(input()))

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

    p = []

    for i in reversed(list(range(n))):

        if a[i]:

            p.append(i + 1)

            u = 1

            v = i + 1

            while u * u <= v:

                if v % u == 0:

                    a[u - 1] ^= 1

                    if u != v // u:

                        a[v // u - 1] ^= 1

                u += 1

    if len(p) > 0:

        print((len(p)))

        print((*p))

    else:

        print((0))

main()
from sys import stdin



def main():

    input = stdin.readline

    n = int(eval(input()))

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

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

        a[i] = sum(a[i::i]) % 2

    print((sum(a)))

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

        if a[i] == 1:

            print(i)

main()
from sys import stdin


def main():
    input = stdin.readline
    n = int(eval(input()))
    a = list(map(int, input().split()))
    p = []
    for i in reversed(list(range(n))):
        if a[i]:
            p.append(i + 1)
            u = 1
            v = i + 1
            while u * u <= v:
                if v % u == 0:
                    a[u - 1] ^= 1
                    if u != v // u:
                        a[v // u - 1] ^= 1
                u += 1
    if len(p) > 0:
        print((len(p)))
        print((*p))
    else:
        print((0))


main()

from sys import stdin


def main():
    input = stdin.readline
    n = int(eval(input()))
    a = [0] + list(map(int, input().split()))
    for i in range(n, 0, -1):
        a[i] = sum(a[i::i]) % 2
    print((sum(a)))
    for i in range(1, n + 1):
        if a[i] == 1:
            print(i)


main()

-    a = list(map(int, input().split())) -    p = [] -    for i in reversed(list(range(n))): -        if a[i]: -            p.append(i + 1) -            u = 1 -            v = i + 1 -            while u * u <= v: -                if v % u == 0: -                    a[u - 1] ^= 1 -                    if u != v // u: -                        a[v // u - 1] ^= 1 -                u += 1 -    if len(p) > 0: -        print((len(p))) -        print((*p)) -    else: -        print((0)) +    a = [0] + list(map(int, input().split())) +    for i in range(n, 0, -1): +        a[i] = sum(a[i::i]) % 2 +    print((sum(a))) +    for i in range(1, n + 1): +        if a[i] == 1: +            print(i)