import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

main = do
  [n] <- getInts
  s <- B.getLine
  print $ fst $ B.foldl f (0,0) s
  where
    c2i 'I' = 1
    c2i _ = -1
    f (mx,x) c = (max mx (x + c2i c), x + c2i c)

-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

substr :: Int -> Int -> B.ByteString -> B.ByteString
substr b l s = B.take l $ B.drop b s
