var input = require('fs').readFileSync('/dev/stdin', 'utf8').split("\n");
var n = Number(input[0]);
var ans = 0;
var tmp = 0;
var tx = input[1].split("");
for(var i in tx){
    if(tx[i] == 'I'){
        tmp++;
    }else{
        tmp--;
    }
    ans = Math.max(ans,tmp);
}
console.log(ans);
