program main
  implicit none
  integer :: n, ans, x, i
  character(100) :: s

  read(*,*) n
  read(*,*) s

  x = 0
  ans = 0

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

     ans = max(ans,x)
  end do
  write(*,*) ans
end program main

     
