import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Debug.Trace
import Data.List

solveInner :: String -> Int -> Int -> Int
solveInner [] maxX _ = maxX
solveInner (c:s) maxX accum
    = solveInner s (max maxX acc) acc
    where
        diff = if c == 'I' then 1 else -1
        acc = accum + diff

solve:: String -> Int
solve str = solveInner str 0 0

main :: IO ()
main = do
    _ <- BS.getLine
    s <- BS.unpack <$> BS.getLine
    print $ solve s
