let ans n s =
  let rec f i x m =
    if i = n then m
    else if s.[i] = 'I' then f (i+1) (x+1) (max m (x+1))
    else f (i+1) (x-1) m
  in f 0 0 0

let () = Scanf.scanf "%d\n%s" (fun n s -> print_int (ans n s))
