
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    var ans = 0
    var num = 0
    for(i in s) {
        if(i == 'I') {
            num++
        } else {
            num--
        }
        ans = Math.max(ans, num)
    }
    println(ans)
}