eater::Int->[Char]->[Int]
eater init_num [] = []
eater init_num (cm:rest) = let v = (init_num + (if cm =='I' then 1 else (-1))) in
                           v:(eater v rest)
solver::Int->[Char]->Int
solver v ls = maximum (v:(eater v ls))

main::IO()
main=do
  _<-getLine
  str<-getLine
  print (solver 0 str)