# ABC134D - Preparing Boxes

def main():

    n = int(eval(input()))

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

    B = [0] * (n + 1)

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

        cnt, p = 0, 2

        while i * p <= n:

            cnt += B[i * p]

            p += 1

        if cnt % 2 != A[i]:

            B[i] += 1

    total = sum(B)

    if total == 0:

        print((0))

    else:

        print(total)

        print((*(i for i, j in enumerate(B[1:], start=1) if j == 1)))





if __name__ == "__main__":

    main()
# ABC134D - Preparing Boxes

# Better ver.

def main():

    n = int(eval(input()))

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

    for i in range(n // 2, 0, -1):  # second half: no multiples

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

    ans = [i for i, j in enumerate(A) if j]

    print((len(ans)))  # all cells: [1] -> len() (much faster than sum())

    print((*ans))





if __name__ == "__main__":

    main()
# ABC134D - Preparing Boxes
def main():
    n = int(eval(input()))
    A = [0] + list(map(int, input().rstrip().split()))
    B = [0] * (n + 1)
    for i in range(n, 0, -1):
        cnt, p = 0, 2
        while i * p <= n:
            cnt += B[i * p]
            p += 1
        if cnt % 2 != A[i]:
            B[i] += 1
    total = sum(B)
    if total == 0:
        print((0))
    else:
        print(total)
        print((*(i for i, j in enumerate(B[1:], start=1) if j == 1)))


if __name__ == "__main__":
    main()

# ABC134D - Preparing Boxes
# Better ver.
def main():
    n = int(eval(input()))
    A = [0] + list(map(int, input().rstrip().split()))
    for i in range(n // 2, 0, -1):  # second half: no multiples
        A[i] = sum(A[i::i]) % 2
    ans = [i for i, j in enumerate(A) if j]
    print((len(ans)))  # all cells: [1] -> len() (much faster than sum())
    print((*ans))


if __name__ == "__main__":
    main()

+# Better ver. -    B = [0] * (n + 1) -    for i in range(n, 0, -1): -        cnt, p = 0, 2 -        while i * p <= n: -            cnt += B[i * p] -            p += 1 -        if cnt % 2 != A[i]: -            B[i] += 1 -    total = sum(B) -    if total == 0: -        print((0)) -    else: -        print(total) -        print((*(i for i, j in enumerate(B[1:], start=1) if j == 1))) +    for i in range(n // 2, 0, -1):  # second half: no multiples +        A[i] = sum(A[i::i]) % 2 +    ans = [i for i, j in enumerate(A) if j] +    print((len(ans)))  # all cells: [1] -> len() (much faster than sum()) +    print((*ans))