let () =
  let n = read_int () in
  let s = read_line () in
  let ar = Array.make n 0 in
  String.iteri (fun i c ->
              if c = 'I' then ar.(i) <- 1 else ar.(i) <- (-1)) s;
  Array.fold_left (fun (x, y) z -> let w = y + z in (max x w, w)) (0, 0) ar |> fst |> string_of_int |> print_endline
