using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = CinT();
            var a = CinTAr();
            int[] r = new int[n];
            string st = "";
            int c = 0;
            int bp = 0;
            for(int i = n;i > 0; i--)
            {
                int fasd = 0;
                for(int g = i + i;g <= n; g += i)
                {
                    fasd+= r[g -1];
                }
                if(fasd % 2 != a[i - 1])
                {
                    //for (int g = i; g <= n; g += i)
                    //{
                    //    r[g - 1]+=1;
                    //}
                    r[i - 1] = 1;
                }
                //CoutAr(r);
            }
            //for (int i = 0; i < n; i++)
            //{
            //    if (r[i] % 2 != a[i])
            //    {
            //        Cout(-1);
            //        return;
            //    }
            //}
            List<int> af = new List<int>();
            for(int i = 0;i < n; i++)
            {
                if(r[i] % 2 >= 1)
                {
                    af.Add(i + 1);
                }
            }

            if(af.Count == 0)
            {
                Cout(0);
            }
            else
            {
                Cout(af.Count);
                for(int i = 0; i < af.Count; i++)
                {
                    Write(af[i] + " ");
                }
            }
            Cin();
        }

        static int[] yakusuu(int n)
        {
            if(n == 1)
            {
                return new int[] { 1 };
            }
            List<int> res = new List<int>();
            for(int i = 1; i <= Math.Ceiling(n / 2.0); i++)
            {
                if(n % i == 0)
                {
                    res.Add(i);
                    res.Add(n / i);
                }
            }
            return res.ToArray();
        }

        static readonly int MOD1E9 = (int)1e9 + 7;
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void OYes() { Cout("Yes"); }
        static void ONo() { Cout("No"); }
        static void Cout(object s) { WriteLine(s); }
        /// <summary>
        /// Debug時のみの使用を推奨
        /// </summary>
        /// <typeparam name="Type"></typeparam>
        /// <param name="types"></param>
        static void CoutAr<Type>(IEnumerable<Type> types)
        {
            string text = "";
            foreach (var i in types)
            {
                text += " " + i;
            }
            WriteLine(text.Substring(1));
        }
    }
}


Measured memory_bytes: 30932