program ABC052B
    implicit none
    integer(8)::N,i
    integer(8)::calc=0
    integer(8)::result=0
    character(100)::S
    read(5,*)N,S
    do i=1,N
        if(S(i:i)=="I")then
            calc=calc+1
        else
            calc=calc-1
        end if
        if(calc>result)result=calc
    end do
    print'(i0)',result
end program ABC052B