program prob1
    implicit none
    integer::i, j, N, tmp, ans
    character(len=100)::S
    read(*,*) N
    read(*,*) S
    tmp = 0
    ans = 0
    do i = 1, N
        if(S(i:i) .eq. 'I') then
            tmp = tmp + 1
        else
            tmp = tmp - 1
        end if
        ans = max(ans, tmp)
    end do

    write(*,*) ans
    stop
end program