function main(input){
  const args = input.split(" ");
  const N = parseInt(args[0]),
        S = args[1].split(""),
        x = 0,
        list = [0];
  
  for(var i = 0; i < S.length; i++){
    if S[i] === "I"
      x++;
      list.push(x);
    else
      x--;
      list.push(x);
  }
  console.log(Math.max(...list));
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));