main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  strs <- getLine
  print $ solve strs
  
solve :: String -> Int
solve strs = maximum $ scanl incdec 0 strs
  where
    incdec :: Int -> Char -> Int
    incdec i 'D' = i - 1
    incdec i 'I' = i + 1
    incdec i _ = i
