import sys

n = int(eval(input()))

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



box = [0 for _ in range(n+1)]

result = []

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

    counter = 0

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

        counter += box[j*i]

    if counter % 2 != a[i-1]:

        box[i] = 1

        result.append(i)

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

    counter = 0

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

        counter += box[j*i]

    if counter%2 != a[i-1]:

        print((1))

        sys.exit()



print((len(result)))

if len(result) != 0:

    print((*result[::-1]))        
def main():

    import sys

    n = int(eval(input()))

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



    box = [0 for _ in range(n+1)]

    result = []

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

        counter = 0

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

            counter += box[j*i]

        if counter % 2 != a[i-1]:

            box[i] = 1

            result.append(i)

    """

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

        counter = 0

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

            counter += box[j*i]

        if counter%2 != a[i-1]:

            print(-1)

            sys.exit()

    """

    print((len(result)))

    if len(result) != 0:

        print((*result[::-1]))  

if __name__ == '__main__':

    main()      
import sys

n = int(eval(input()))
a = list(map(int, input().split()))
box = [0 for _ in range(n + 1)]
result = []
for i in range(n, 0, -1):
    counter = 0
    for j in range(1, (n // i) + 1):
        counter += box[j * i]
    if counter % 2 != a[i - 1]:
        box[i] = 1
        result.append(i)
for i in range(1, n + 1):
    counter = 0
    for j in range(1, (n // i) + 1):
        counter += box[j * i]
    if counter % 2 != a[i - 1]:
        print((1))
        sys.exit()
print((len(result)))
if len(result) != 0:
    print((*result[::-1]))

def main():
    import sys

    n = int(eval(input()))
    a = list(map(int, input().split()))
    box = [0 for _ in range(n + 1)]
    result = []
    for i in range(n, 0, -1):
        counter = 0
        for j in range(1, (n // i) + 1):
            counter += box[j * i]
        if counter % 2 != a[i - 1]:
            box[i] = 1
            result.append(i)
    """
    for i in range(1, n+1):
        counter = 0
        for j in range(1, (n//i)+1):
            counter += box[j*i]
        if counter%2 != a[i-1]:
            print(-1)
            sys.exit()
    """
    print((len(result)))
    if len(result) != 0:
        print((*result[::-1]))


if __name__ == "__main__":
    main()

-import sys +def main(): +    import sys -n = int(eval(input())) -a = list(map(int, input().split())) -box = [0 for _ in range(n + 1)] -result = [] -for i in range(n, 0, -1): -    counter = 0 -    for j in range(1, (n // i) + 1): -        counter += box[j * i] -    if counter % 2 != a[i - 1]: -        box[i] = 1 -        result.append(i) -for i in range(1, n + 1): -    counter = 0 -    for j in range(1, (n // i) + 1): -        counter += box[j * i] -    if counter % 2 != a[i - 1]: -        print((1)) -        sys.exit() -print((len(result))) -if len(result) != 0: -    print((*result[::-1])) +    n = int(eval(input())) +    a = list(map(int, input().split())) +    box = [0 for _ in range(n + 1)] +    result = [] +    for i in range(n, 0, -1): +        counter = 0 +        for j in range(1, (n // i) + 1): +            counter += box[j * i] +        if counter % 2 != a[i - 1]: +            box[i] = 1 +            result.append(i) +    """ +    for i in range(1, n+1): +        counter = 0 +        for j in range(1, (n//i)+1): +            counter += box[j*i] +        if counter%2 != a[i-1]: +            print(-1) +            sys.exit() +    """ +    print((len(result))) +    if len(result) != 0: +        print((*result[::-1])) + + +if __name__ == "__main__": +    main()