n = int(eval(input()))

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

ls = [0] * n

ans = []

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

    t = 0

    for j in range(i, n, (i + 1)):

        t += ls[j]

    if a[i] != t % 2:

        ans.append(i + 1)

        ls[i] = 1

print((len(ans)))

if len(ans) != 0:

    print((*ans))

def slove():

    import sys

    input = sys.stdin.readline

    n = int(input().rstrip('\n'))

    a = list(map(int, input().rstrip('\n').split()))

    b = [0] * n

    ans = []

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

        cnt = 0

        for j in range(i, n, i + 1):

            cnt += b[j]

        if cnt % 2 != a[i]:

            b[i] += 1

            ans.append(i + 1)

    print((len(ans)))

    if len(ans) != 0:

        print((*ans))





if __name__ == '__main__':

    slove()

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

def slove():
    import sys

    input = sys.stdin.readline
    n = int(input().rstrip("\n"))
    a = list(map(int, input().rstrip("\n").split()))
    b = [0] * n
    ans = []
    for i in range(n - 1, -1, -1):
        cnt = 0
        for j in range(i, n, i + 1):
            cnt += b[j]
        if cnt % 2 != a[i]:
            b[i] += 1
            ans.append(i + 1)
    print((len(ans)))
    if len(ans) != 0:
        print((*ans))


if __name__ == "__main__":
    slove()

-n = int(eval(input())) -a = list(map(int, input().split())) -ls = [0] * n -ans = [] -for i in range(n - 1, -1, -1): -    t = 0 -    for j in range(i, n, (i + 1)): -        t += ls[j] -    if a[i] != t % 2: -        ans.append(i + 1) -        ls[i] = 1 -print((len(ans))) -if len(ans) != 0: -    print((*ans)) +def slove(): +    import sys + +    input = sys.stdin.readline +    n = int(input().rstrip("\n")) +    a = list(map(int, input().rstrip("\n").split())) +    b = [0] * n +    ans = [] +    for i in range(n - 1, -1, -1): +        cnt = 0 +        for j in range(i, n, i + 1): +            cnt += b[j] +        if cnt % 2 != a[i]: +            b[i] += 1 +            ans.append(i + 1) +    print((len(ans))) +    if len(ans) != 0: +        print((*ans)) + + +if __name__ == "__main__": +    slove()