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