program main
  implicit none
  integer :: n, i, res, x
  character(100) :: s
  read (*, *) n
  read (*, *) s
  x = 0
  res = 0
  do i = 1, n
    if (s(i:i) == "I") then
      x = x + 1
    else
      x = x - 1
    end if
    res = max(res, x)
  end do
  write (*, "(i0)") res
end program main
