main :: IO ()
main = do
    _ <- getLine
    s <- getLine
    print $ solve s

solve :: String -> Int
solve s = maximum $ scanl1 (+) as
    where
        conv x = if x=='I' then 1 else -1
        as = map conv s
