import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n: Int = sc.nextInt()
    val s: String = sc.next()
    var max: Int = 0
    var x: Int = 0
    for (i in 0 until n){
        if (s[i] == 'I') {
            x++
        } else {
            x--
        }
        max = Math.max(x, max)
    }
    println(max)
}