process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var len = Number(lines[0]);
 var s = lines[1].split('');
 var x = 0;
 var ar = [];
 ar.push(x);
 for(i=0; i<len; i++){
   if(s[i] == 'I'){
     x++;
     ar.push(x);
   }else if(s[i] == 'D'){
     x--;
     ar.push(x);
   }
 }

 console.log(Math.max(...ar));
});