'use strict'

function Main(input) {
  let max = 0;
  let cnt = 0;
  const arr = input.split('\n');
  const len = arr[0];
  const str = String(arr[1]);
  for (let i = 0; i < len; i++) {
    if (str.charAt(i) === 'I') {
      cnt += 1;
      max = Math.max(max, cnt);
    } else if (str.charAt(i) === 'D') {
      cnt -= 1;
    }
  }
  console.log(max);
}

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