import scala.io.StdIn._
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val s = sc.next
  var ans=0
  var num=0
  for(i <-0 to s.length()-1)
  if(s.charAt(i)=='I'){
    num+=1
    if(ans<num){
      ans=num
    }
  }
  else{
    num-=1
  }
  print(ans)
}