program sample
    implicit none
    character(100)::s
    character(3)::ans
    integer(8) :: i,j,m,n,max
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*)n
    read(*,*)s
    m=0
    max=0
    do i=1,n
        if(s(i:i) .eq. 'I')then
            m=m+1
            if(m>max)then
                max=m
            end if
        else
            m=m-1
        endif
    end do
    
  
    write(*,*)max
    stop
end program sample
  

