let id a = a
let n = Scanf.scanf "%d\n" id
let repeat f =
  let rec loop acc = function
    | 0 -> List.rev acc
    | n -> loop (f () :: acc) (n-1) in
  loop []

let r = repeat (fun () -> Scanf.scanf "%c" id) n

let rec ans x list = function
  | [] -> list
  | a :: rest ->
     match a with
     | 'I' -> ans (x+1) ((x+1) :: list) rest
     | 'D' -> ans (x-1) ((x-1) :: list) rest
     | _   -> ans x (x :: list) rest

let anslist = ans 0 [] r 

let rec maxlist l x =
  match l with
  | [] -> x
  | a :: rest -> if a > x then maxlist rest a else maxlist rest x
 
let saidai = maxlist anslist 0
	
let () = Printf.printf "%d\n" saidai
