program A326A
    implicit none
    integer(8)::N,ans,i,calc
    character(100)::S
    read*,N,S
    ans=0
    calc=0
    do i=1,N
        if(S(i:i)=="I")calc=calc+1
        if(S(i:i)=="D")calc=calc-1
        ans=max(ans,calc)
    end do

    print'(i0)',ans
end program A326A