n = int(eval(input()))

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



filled = [0]*(n+1)

ans = []

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

  if sum(filled[::i+1][1:]) % 2 != A[i]:

    filled[i+1] = 1

    ans.append(i+1)

print((len(ans)))

print((' '.join(map(str, ans))))
def main():

    n = int(eval(input()))

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



    filled = [0]*(n+1)

    ans = []

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

        if sum(filled[::i+1][1:]) % 2 != A[i]:

            filled[i+1] = 1

            ans.append(i+1)

    print((len(ans)))

    print((' '.join(map(str, ans))))





if __name__ == '__main__':

    main()
n = int(eval(input()))
A = list(map(int, input().split()))
filled = [0] * (n + 1)
ans = []
for i in range(n - 1, -1, -1):
    if sum(filled[:: i + 1][1:]) % 2 != A[i]:
        filled[i + 1] = 1
        ans.append(i + 1)
print((len(ans)))
print((" ".join(map(str, ans))))

def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    filled = [0] * (n + 1)
    ans = []
    for i in range(n - 1, -1, -1):
        if sum(filled[:: i + 1][1:]) % 2 != A[i]:
            filled[i + 1] = 1
            ans.append(i + 1)
    print((len(ans)))
    print((" ".join(map(str, ans))))


if __name__ == "__main__":
    main()

-n = int(eval(input())) -A = list(map(int, input().split())) -filled = [0] * (n + 1) -ans = [] -for i in range(n - 1, -1, -1): -    if sum(filled[:: i + 1][1:]) % 2 != A[i]: -        filled[i + 1] = 1 -        ans.append(i + 1) -print((len(ans))) -print((" ".join(map(str, ans)))) +def main(): +    n = int(eval(input())) +    A = list(map(int, input().split())) +    filled = [0] * (n + 1) +    ans = [] +    for i in range(n - 1, -1, -1): +        if sum(filled[:: i + 1][1:]) % 2 != A[i]: +            filled[i + 1] = 1 +            ans.append(i + 1) +    print((len(ans))) +    print((" ".join(map(str, ans)))) + + +if __name__ == "__main__": +    main()