import sys



input = sys.stdin.readline



n = int(eval(input()))

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

a = [None] + a

a = tuple(a)



ans = set()

cnt = [0] * (n + 1)



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

    if cnt[i] % 2 != a[i] % 2:

        ans.add(i)



        st = set()

        j = 1

        while j * j <= i:

            if i % j == 0:

                st.add(j)

                st.add(i // j)

            j += 1

        for d in st:

            cnt[d] += 1



print((len(ans)))

print((*ans))

def main():

    N = int(input())



    a = [0]

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



    b = [0] * (N + 1)



    x = N

    k = 1

    while x > 0:

        while x * (k + 1) > N:

            t = 0

            for j in range(2, k + 1):

                t ^= b[x * j]

            b[x] = a[x] ^ t

            x -= 1

        k += 1



    ans = [i for i, x in enumerate(b) if x == 1]

    print(len(ans))

    print(*ans, sep='\n')





if __name__ == '__main__':

    main()



# import sys

# input = sys.stdin.readline

# 

# sys.setrecursionlimit(10 ** 7)

# 

# (int(x)-1 for x in input().split())

# rstrip()

#

# def binary_search(*, ok, ng, func):

#     while abs(ok - ng) > 1:

#         mid = (ok + ng) // 2

#         if func(mid):

#             ok = mid

#         else:

#             ng = mid

#     return ok

import sys

input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
a = [None] + a
a = tuple(a)
ans = set()
cnt = [0] * (n + 1)
for i in range(n, 0, -1):
    if cnt[i] % 2 != a[i] % 2:
        ans.add(i)
        st = set()
        j = 1
        while j * j <= i:
            if i % j == 0:
                st.add(j)
                st.add(i // j)
            j += 1
        for d in st:
            cnt[d] += 1
print((len(ans)))
print((*ans))

def main():
    N = int(input())
    a = [0]
    a += map(int, input().split())
    b = [0] * (N + 1)
    x = N
    k = 1
    while x > 0:
        while x * (k + 1) > N:
            t = 0
            for j in range(2, k + 1):
                t ^= b[x * j]
            b[x] = a[x] ^ t
            x -= 1
        k += 1
    ans = [i for i, x in enumerate(b) if x == 1]
    print(len(ans))
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

-import sys +def main(): +    N = int(input()) +    a = [0] +    a += map(int, input().split()) +    b = [0] * (N + 1) +    x = N +    k = 1 +    while x > 0: +        while x * (k + 1) > N: +            t = 0 +            for j in range(2, k + 1): +                t ^= b[x * j] +            b[x] = a[x] ^ t +            x -= 1 +        k += 1 +    ans = [i for i, x in enumerate(b) if x == 1] +    print(len(ans)) +    print(*ans, sep="\n") -input = sys.stdin.readline -n = int(eval(input())) -a = list(map(int, input().split())) -a = [None] + a -a = tuple(a) -ans = set() -cnt = [0] * (n + 1) -for i in range(n, 0, -1): -    if cnt[i] % 2 != a[i] % 2: -        ans.add(i) -        st = set() -        j = 1 -        while j * j <= i: -            if i % j == 0: -                st.add(j) -                st.add(i // j) -            j += 1 -        for d in st: -            cnt[d] += 1 -print((len(ans))) -print((*ans)) + +if __name__ == "__main__": +    main() +# import sys +# input = sys.stdin.readline +# +# sys.setrecursionlimit(10 ** 7) +# +# (int(x)-1 for x in input().split()) +# rstrip() +# +# def binary_search(*, ok, ng, func): +#     while abs(ok - ng) > 1: +#         mid = (ok + ng) // 2 +#         if func(mid): +#             ok = mid +#         else: +#             ng = mid +#     return ok