function Main(input){
var inputs = input.split("\n");
var arra = inputs[1].split("");
var x = 0;
var a = [];
for(i=0;i<=(arra.length - 1);i++){
  if(arra[i] == "I"){
    x += 1;
    a[i] = x;
  }else{
    x -= 1;
    a[i] = x;
  }
}
var answer = Math.max.apply(null,a);
console.log(answer);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));