function main(input){
  var n = parseInt(input.split("\n")[0]);
  var s = input.split("\n")[1];
  var cnt = 0;
  var ans = [0];
  
  for (i=0; i<n; i++){
    if (s[i] == "I"){
      cnt = cnt+1;
    }else{
      cnt = cnt-1;
    }
    ans.push(cnt);
  }
  
  console.log(Math.max.apply(null, ans))
}

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