fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val ans = (0 .. s.length).map { s.take(it).let { it.count { it == 'I' } - it.count { it == 'D' } } }.max()
    println(ans)
}