Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i cur acc =
        if i = n then acc else
            if a.(i) = cur then loop (i + 1) (cur + 1) acc  else
            if a.(i) < cur then loop (i + 1) cur acc else
                loop (i + 1) cur (acc + (a.(i) - 1) / cur)
    in
    loop 1 2 (a.(0) - 1) |> Printf.printf "%d\n"
)