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