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

main(require('fs').readFileSync('/dev/stdin', 'utf8'));