import Control.Monad
import Control.Monad.Writer

main :: IO ()
main = do
    [n, s] <- replicateM 2 getLine
    print . maximum . (0:) . snd . runWriter $ foldM calc 0 s

calc :: Int -> Char -> Writer [Int] Int
calc y x = tell [res] >> return res
    where
        res | x == 'I' = y + 1
            | otherwise = y - 1