"use strict";
const main = arg => {
  let info = arg.split("\n");
  let max = 0;
  let tmp = 0;
  for(let t of info[1]){
    if(t == "I"){
      tmp += 1;
    } else {
      tmp -= 1;
    }
    if(max < tmp){
    	max = tmp;
    }
  }
  
  console.log(max);
}

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