import scala.io.{ StdIn => in}

object Main extends App {
  val n = in.readInt
  val ans = in.readLine.toCharArray
    .take(n)
    ./:(0,0)((acc,ch) => {
      val x = if(ch == 'I') acc._2 + 1 else acc._2 - 1
      (math.max(acc._1, x), x)
    })._1
  println(ans)
}