count (x:xs) a b = if x == 'I'
                     then count xs (a + 1) (max b (a + 1))
                     else count xs (a - 1) b
count [] a b = b

main = do
  n <- getLine
  line <- getLine
  print $ count line 0 0
