Scanf.scanf "%d" (fun n -> let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in let ao = Array.fold_left (lor) 0 a in let rec loop i = if i land ao = 0 then i else loop (i * 2) in loop 1 |> Printf.printf "%d\n" )