object Main {
  def f(c : Char) : Int = c match {
  	case 'I' => 1
    case 'D' => -1
  }
  
  def main(args : Array[String]) {
    io.StdIn.readLine()
    println(io.StdIn.readLine.map(f).scanLeft(0)(_ + _).max)
  }
}