import Control.Applicative
import Control.Monad
import Data.List

f :: Int -> Char -> Int
f acc 'I' = acc + 1
f acc 'D' = acc - 1

main :: IO ()
main = do
    getLine
    ss <- getLine
    let as = scanl' f 0 ss
    print $ maximum as