program main
implicit none
integer :: i, j, k
integer :: n
character :: s*100

read(*,*) n
read(*,*) s(1:n)
j = 0
k = 0
do i = 1, n
   if( s(i:i) == 'I' ) then
      j = j + 1
   else
      j = j - 1
   end if
   if( j .ge. k ) then
      k = j
   end if
end do
write(*,'(i0)') k



end program main
