fun main(args: Array<String>) {
    readLine()
    val S = readLine()!!

    var x = 0
    var res = 0
    for (c in S.toCharArray()) {
        if (c == 'I') {
            x++
        } else {
            x--
        }
        res = Math.max(res, x)
    }
    println(res)
}