import scala.io.StdIn._

object Main extends App{
  val count = readLine.toInt
  val words = readLine

  var current = 0
  var max = 0

  words.foreach {
    case 'I' => {
      current = current + 1
      if(current > max) { max = current }
    }
    case 'D' => {
      current = current - 1
    }
   }

  println(max)
}