import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10**8)

INF = float('inf')

MOD = 10**9+7





def main():

  N = int(readline())

  A = [None] + list(map(int, readline().split()))

  ans = []

  choosen = [0] * (N+1)

  

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

    x = sum(choosen[n::n])

    if x %2 == A[n]:

      continue

    choosen[n] += 1

    ans.append(str(n))

  print((len(ans)))

  print((' '.join(ans)))

  

  

if __name__ == '__main__':

  main()
import sys

readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)

INF = float('inf')

MOD = 10 ** 9 + 7



def main():

    N = int(readline())

    A = [0] + list(map(int, readline().split()))

    B = [0] * (N+1)

    ans = []

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

        x = sum(B[i::i])

        if x%2==A[i]:

            continue

        else:

            B[i] = 1

            ans.append(str(i))

    print((len(ans)))

    print((' '.join(ans)))









if __name__ == '__main__':

    main()
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7


def main():
    N = int(readline())
    A = [None] + list(map(int, readline().split()))
    ans = []
    choosen = [0] * (N + 1)
    for n in range(N, 0, -1):
        x = sum(choosen[n::n])
        if x % 2 == A[n]:
            continue
        choosen[n] += 1
        ans.append(str(n))
    print((len(ans)))
    print((" ".join(ans)))


if __name__ == "__main__":
    main()

import sys

readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7


def main():
    N = int(readline())
    A = [0] + list(map(int, readline().split()))
    B = [0] * (N + 1)
    ans = []
    for i in range(N, 0, -1):
        x = sum(B[i::i])
        if x % 2 == A[i]:
            continue
        else:
            B[i] = 1
            ans.append(str(i))
    print((len(ans)))
    print((" ".join(ans)))


if __name__ == "__main__":
    main()

-read = sys.stdin.buffer.read -readlines = sys.stdin.buffer.readlines -    A = [None] + list(map(int, readline().split())) +    A = [0] + list(map(int, readline().split())) +    B = [0] * (N + 1) -    choosen = [0] * (N + 1) -    for n in range(N, 0, -1): -        x = sum(choosen[n::n]) -        if x % 2 == A[n]: +    for i in range(N, 0, -1): +        x = sum(B[i::i]) +        if x % 2 == A[i]: -        choosen[n] += 1 -        ans.append(str(n)) +        else: +            B[i] = 1 +            ans.append(str(i))