object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val s = sc.next()
  val ans = s.scanLeft(0){case (a, c) => if (c == 'I') a+1 else a-1}.max
  println(ans)
}
