function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var max = 0;
  var incre = 0;
  for(var i = 0; i < parseInt(input[0]); i++){
    var tmp = input[1].slice(i,i+1);
    if(tmp == "I"){
       incre++;
       }else{
       incre--;
       }
    max = Math.max(max,incre);
  }
  myout(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());