program prob2
    implicit none
    character(105) :: s
    integer :: n, i, ans, anss
    read(*,*) n, s
    ans = 0
    anss = 0
    do i = 1, n
        if(s(i:i) == 'I')then
            ans = ans + 1
        else 
            ans = ans - 1
        end if
        anss = max(anss, ans)
    end do
    write(*,*) anss

    stop
contains
end program prob2