import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val s = sc.next

  val res =
    s.foldLeft((0,0)){case ((x, max), c)=>
      val newX = x + ( if(c == 'I') 1 else -1 )
      (newX, Math.max(max, newX))
    }._2

  println(res)
}