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