private inline fun <T, R> Collection<T>.foldEach(initial: R, operation: (R, T) -> R): List<R> {
    var accumulator = initial
    val result = mutableListOf(accumulator)
    for (element in this) accumulator = operation(accumulator, element).apply { result.add(this) }
    return result.toList()
}

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

    println(S.map { if (it == 'I') 1 else -1 }.foldEach(0) { f, s -> f + s }.max())
}