defmodule Main do
  def main do
    _ = IO.gets("")
    
    IO.gets("")
    |> String.trim()
    |> String.split("", trim: true)
    |> process(0, 0)
    |> IO.puts()
  end
  
  defp process([], _, max), do: max
  
  defp process(["I" | tail], acc, max) do
    case acc + 1 > max do
      true -> process(tail, acc + 1, acc + 1)
      false -> process(tail, acc + 1, max)
    end
  end
  
  defp process(["D" | tail], acc, max) do
    process(tail, acc - 1, max)
  end
end