n = int(eval(input()))

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

res = [0 for i in range(n)]

lres = []

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

    l = []

    flag = 0

    t = i*2

    while t <= n:

        flag = flag ^ res[t-1]

        t = t+i

    if a[i-1] != flag:

        res[i-1] = 1

        lres.append(str(i))



print((len(lres)))

if len(lres) != 0:

    print((" ".join(lres)))

 
def main():

    n = int(eval(input()))

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

    res = [0 for i in range(n)]

    lres = []

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

        l = []

        flag = 0

        t = i*2

        while t <= n:

            flag = flag ^ res[t-1]

            t = t+i

        if a[i-1] != flag:

            res[i-1] = 1

            lres.append(str(i))



    print((len(lres)))

    if len(lres) != 0:

        print((" ".join(lres)))



main()
n = int(eval(input()))
a = list(map(int, input().split()))
res = [0 for i in range(n)]
lres = []
for i in range(n, 0, -1):
    l = []
    flag = 0
    t = i * 2
    while t <= n:
        flag = flag ^ res[t - 1]
        t = t + i
    if a[i - 1] != flag:
        res[i - 1] = 1
        lres.append(str(i))
print((len(lres)))
if len(lres) != 0:
    print((" ".join(lres)))

def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    res = [0 for i in range(n)]
    lres = []
    for i in range(n, 0, -1):
        l = []
        flag = 0
        t = i * 2
        while t <= n:
            flag = flag ^ res[t - 1]
            t = t + i
        if a[i - 1] != flag:
            res[i - 1] = 1
            lres.append(str(i))
    print((len(lres)))
    if len(lres) != 0:
        print((" ".join(lres)))


main()

-n = int(eval(input())) -a = list(map(int, input().split())) -res = [0 for i in range(n)] -lres = [] -for i in range(n, 0, -1): -    l = [] -    flag = 0 -    t = i * 2 -    while t <= n: -        flag = flag ^ res[t - 1] -        t = t + i -    if a[i - 1] != flag: -        res[i - 1] = 1 -        lres.append(str(i)) -print((len(lres))) -if len(lres) != 0: -    print((" ".join(lres))) +def main(): +    n = int(eval(input())) +    a = list(map(int, input().split())) +    res = [0 for i in range(n)] +    lres = [] +    for i in range(n, 0, -1): +        l = [] +        flag = 0 +        t = i * 2 +        while t <= n: +            flag = flag ^ res[t - 1] +            t = t + i +        if a[i - 1] != flag: +            res[i - 1] = 1 +            lres.append(str(i)) +    print((len(lres))) +    if len(lres) != 0: +        print((" ".join(lres))) + + +main()