function main(input){
  const args = input.split(" ");
  const N = parseInt(args[0]),
        S = args[1],
        x = 0,
        maxv = 0;
  
  for(var i = 0; i < S.length; i++){
    if S[i] === "I"
      x++;
      if x > maxv
         maxv = x;
    else
      x--;
  }
  console.log(maxv);
}

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