program answer
  implicit none
  integer :: N, j, ans, count
  character(len=100) :: S
  character(len=1) :: ss

  ss='I'

  read(*,*) N
  read(*,*) S

  count=0
  ans=0

  do j = 1, N
     if(S(j:j)==ss(1:1)) then
        count=count+1
     else
        count=count-1
     end if

     if(count>ans) then
        ans=count
     end if
  end do

  write(*,*) ans

  stop
 end program answer