'use strict'

function main(input) {
  input = input.split('\n')
  const length = input[0]
  let res = 0;
  let list = [0];
  const text = input[1].split('')
  for (let i = 0;i < length;i++) {
    if (text[i] == 'I') {
      res++;
    } else {
      res--;
    }
    list.push(res);
  }
  console.log(Math.max(...list));
}

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