import math.max
object Main extends App {
    val n = io.StdIn.readInt
    val s = io.StdIn.readLine

    def rec(str: String, count: Int, max_count: Int): Int = {
        if (str.isEmpty) max_count
        else str.head match {
            case 'I' => rec(str.tail, count+1, max(count+1, max_count))
            case 'D' => rec(str.tail, count-1, max(count-1, max_count))
        }
    }

    val result = rec(s, 0, 0)
    println(result)
}