"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const N = arg[0];
    const S = arg[1];
    let answer  = [0];
    let counter = 0;
    
    for(let i in S) {
        if(S.charAt(i) === "I") {
            counter++;
            answer.push(counter);
        } else {
            counter--;
            answer.push(counter);
        }
    }
    
    console.log(Math.max(...answer));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));