'use strict'

function main(s) {

  s = s.split('\n');

  const n = Number(s[0]);
  const a = s[1].split('');

  let count = 0;
  let cum = [0];

  for (let i = 0; i < n; i++) {
    if (a[i] === 'I') count += 1;
    if (a[i] === 'D') count -= 1;
    
    cum.push(count);
  }

  const ans = Math.max(...cum);

  console.log(ans);
}

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