import sys

def input(): return sys.stdin.readline().rstrip()



def main():

    n = int(eval(input()))

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

    ls = [0] * n



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

        if (sum(ls[i::i+1]) % 2) != a[i]:

            ls[i] = 1

    sum_ls = sum(ls)

    print(sum_ls)

    if sum_ls:

        print((*[i+1 for i, v in enumerate(ls) if v == 1]))



if __name__ == '__main__':

    main()

import sys

def input(): return sys.stdin.readline().rstrip()



def main():

    n = int(eval(input()))

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

    ls = [0] * n

    ans = []



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

        if (sum(ls[i::i+1]) % 2) != a[i]:

            ls[i] = 1

            ans.append(i+1)

    print((sum(ls)))

    if ans:

        print((*ans[::-1]))





if __name__ == '__main__':

    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    n = int(eval(input()))
    a = tuple(map(int, input().split()))
    ls = [0] * n
    for i in range(n - 1, -1, -1):
        if (sum(ls[i :: i + 1]) % 2) != a[i]:
            ls[i] = 1
    sum_ls = sum(ls)
    print(sum_ls)
    if sum_ls:
        print((*[i + 1 for i, v in enumerate(ls) if v == 1]))


if __name__ == "__main__":
    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    n = int(eval(input()))
    a = tuple(map(int, input().split()))
    ls = [0] * n
    ans = []
    for i in range(n - 1, -1, -1):
        if (sum(ls[i :: i + 1]) % 2) != a[i]:
            ls[i] = 1
            ans.append(i + 1)
    print((sum(ls)))
    if ans:
        print((*ans[::-1]))


if __name__ == "__main__":
    main()

+    ans = [] -    sum_ls = sum(ls) -    print(sum_ls) -    if sum_ls: -        print((*[i + 1 for i, v in enumerate(ls) if v == 1])) +            ans.append(i + 1) +    print((sum(ls))) +    if ans: +        print((*ans[::-1]))