import           Control.Monad
import           Data.IORef
import           Data.List.Split
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
  n <- getLine
  s <- getLine

  print $ solve s [0]

solve :: String -> [Int] -> Int
solve "" ans = maximum ans
solve (s : ss) ans | s == 'I'  = solve ss $ ans ++ [last ans + 1]
                   | otherwise = solve ss $ ans ++ [last ans - 1]