program main
    implicit none
    integer(4):: max_x=0, x=0
    integer(4):: n, i
    character(:),ALLOCATABLE:: s

    read*, n
    allocate(character(n):: s)

    read*, s

    do i=1, n
        if (s(i:i) == 'D') x=x-1
        if (s(i:i) == 'I') x=x+1

        max_x = max(max_x,x)
    end do

    print*, max_x
end program main