import Control.Monad
import Data.Array.IO
import Data.Bits
import Data.List
import Debug.Trace

main = do
    n <- read <$> getLine
    a <- map read <$> words <$> getLine
    a <- newListArray (1, n) a
    r <- solve n a
    putStrLn $ show $ length r
    putStrLn $ intercalate " " $ map show $ r

solve :: Int -> IOArray Int Int -> IO [Int]
solve n a = do
    b <- (flip filterM) [n, n - 1 .. 1] $ \i -> do
        b <- readArray a i
        let s = (floor . sqrt . fromIntegral) i
        forM_ [1 .. s] $ \j -> do
            if i /= 1 && i `mod` j == 0 then do
                c <- readArray a j
                writeArray a j (b `xor` c)
                if j /= 1 && (j /= s || i /= s * s) then do
                    c <- readArray a (i `div` j)
                    writeArray a (i `div` j) (b `xor` c)
                else return ()
            else return ()
        return $ b == 1
    return $ reverse b