let n, s = Scanf.scanf " %d %s" @@ fun a b -> a, b
let ans, acc = ref 0, ref 0
let _ =
  String.iter (fun c -> if c = 'I' then incr acc else decr acc; ans := max !ans !acc) s;
  Printf.printf "%d\n" !ans