import Data.ByteString.Char8 as BS

main :: IO ()
main = do
  _ <- BS.getLine
  s <- BS.getLine :: IO BS.ByteString
  print $ calc s 0 0

calc :: BS.ByteString -> Int -> Int -> Int
calc xs n m
  | xs == mempty = m 
  | BS.head xs == 'I' = calc t ninc (max ninc m)
  | otherwise         = calc t ndec m
    where t = BS.tail xs
          ninc = n+1
          ndec = n-1 

