N = int(eval(input()))

l = list(map(int,input().split(' ')))

mid = N // 2

MAP = [0]*N

ans_l = []



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

    s = N // i + 1

    t = 0

    for j in range(1,s):

        t += MAP[i*j-1]

    if t%2 != l[i-1]:

        ans_l.append(str(i))

        MAP[i-1] = 1

leng = len(ans_l)

print(leng)

print((" ".join(ans_l)))
N = int(eval(input()))

l = list(map(int,input().split(' ')))

mid = N // 2

MAP = [0]*N

ans_l = []

for i in range(N-1,mid-1,-1):

    k = l[i]

    MAP[i] = k

    if k==1:

        ans_l.append(str(i+1))

flag = False

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

    s = N // i + 1

    t = 0

    for j in range(2,s):

        t += MAP[i*j-1]

    if t%2==0:

        if l[i-1]%2==1:

            ans_l.append(str(i))

            MAP[i-1] += 1

    else:

        if l[i-1]%2==0:

            ans_l.append(str(i))

            MAP[i-1] += 1

 

leng = len(ans_l)

print(leng)

print((" ".join(ans_l)))
N = int(eval(input()))
l = list(map(int, input().split(" ")))
mid = N // 2
MAP = [0] * N
ans_l = []
for i in range(N, 0, -1):
    s = N // i + 1
    t = 0
    for j in range(1, s):
        t += MAP[i * j - 1]
    if t % 2 != l[i - 1]:
        ans_l.append(str(i))
        MAP[i - 1] = 1
leng = len(ans_l)
print(leng)
print((" ".join(ans_l)))

N = int(eval(input()))
l = list(map(int, input().split(" ")))
mid = N // 2
MAP = [0] * N
ans_l = []
for i in range(N - 1, mid - 1, -1):
    k = l[i]
    MAP[i] = k
    if k == 1:
        ans_l.append(str(i + 1))
flag = False
for i in range(mid, 0, -1):
    s = N // i + 1
    t = 0
    for j in range(2, s):
        t += MAP[i * j - 1]
    if t % 2 == 0:
        if l[i - 1] % 2 == 1:
            ans_l.append(str(i))
            MAP[i - 1] += 1
    else:
        if l[i - 1] % 2 == 0:
            ans_l.append(str(i))
            MAP[i - 1] += 1
leng = len(ans_l)
print(leng)
print((" ".join(ans_l)))

-for i in range(N, 0, -1): +for i in range(N - 1, mid - 1, -1): +    k = l[i] +    MAP[i] = k +    if k == 1: +        ans_l.append(str(i + 1)) +flag = False +for i in range(mid, 0, -1): -    for j in range(1, s): +    for j in range(2, s): -    if t % 2 != l[i - 1]: -        ans_l.append(str(i)) -        MAP[i - 1] = 1 +    if t % 2 == 0: +        if l[i - 1] % 2 == 1: +            ans_l.append(str(i)) +            MAP[i - 1] += 1 +    else: +        if l[i - 1] % 2 == 0: +            ans_l.append(str(i)) +            MAP[i - 1] += 1