fun main(array: Array<String>) {
    var x = 0
    readLine()!!
    val s = readLine()!!
    var temp = 0
    repeat(s.length) {
        if(s[it] == 'I') {
            temp++
        }
        else {
            temp--
        }
        if(x <= temp) x = temp
    }
    print(x)
}