let n = read_int ()
let cs, a_s = Array.(make (n + 1) 0, init n @@ fun _ -> Scanf.scanf " %d" (+) 0)
let g n i = if i < n then cs.(i) <- 1 - cs.(i)
let f g n = let rec f i = if i * i <= n then (if n mod i = 0 then (g n i; if i <> n / i then g n (n / i)); f (i + 1)) in f 1
let _ = for i = n downto 1 do if n / i = 1 then cs.(i) <- a_s.(i - 1) else cs.(i) <- abs @@ cs.(i) - a_s.(i - 1); if cs.(i) = 1 then f g i done; Array.(print_int (fold_left (+) 0 cs); iteri (fun i c -> if c = 1 then Printf.printf (if i = 1 then "\n%d" else " %d") i) cs); print_newline ()