let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let s = Scanf.scanf "%s " (fun a -> a) in
  let cs = Batteries.String.to_list s in
  let is = List.map (fun x -> if x = 'I' then 1 else -1) cs in

  let rec f last res = function
    | [] -> res
    | hd :: tl -> 
      f (last+hd) ((last+hd)::res) tl
  in
  let max = (f 0 [] (0::is) |> List.sort compare |> List.rev |> List.hd) in
  Printf.printf "%d\n" max

