open System;

let _ = Console.ReadLine()
let s = Console.ReadLine()

[for c in s -> c]
|> List.fold (fun (acc, mmax) c -> let tmp = acc + if c = 'I' then 1 else -1
                                   (acc, max acc tmp)) (0, 0)
|> (fun (acc, mmax) -> mmax)
|> Console.WriteLine