import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val s = StdIn.readLine()
  
  val r = s.foldLeft((0, 0)){ (acc, c) =>
    (scala.math.max(acc._1, acc._2 + (if(c == 'I') 1 else -1)),
      acc._2 + (if(c == 'I') 1 else -1))
  }
  
  println(r._1)
  
}
