import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val s = sc.next().toCharArray

    val plus = new Array[Int](n)
    val minus = new Array[Int](n)
    for (i <- plus.indices) {
      if (i == 0) {
        s(i) match {
          case 'I' =>
            plus(i) = 1
            minus(i) = 0
          case 'D' =>
            plus(i) = 0
            minus(i) = 1
        }
      } else {
        s(i) match {
          case 'I' =>
            plus(i) = plus(i - 1) + 1
            minus(i) = minus(i - 1)
          case 'D' =>
            plus(i) = plus(i - 1)
            minus(i) = minus(i - 1) + 1
        }
      }
    }

    val ans = new Array[Int](n)
    for (i <- plus.indices) {
      ans(i) = plus(i) - minus(i)
    }
    println(math.max(ans.max, 0))
  }
}
