import std.stdio, std.string, std.conv, std.algorithm;

void main() {
    readln;
    auto S = readln.chomp.map!(a => a == 'I' ? 1 : -1);
    auto c = 0;
    auto res = 0;
    foreach (s; S) {
        c += s;
        res = max(res, c);
    }
    writeln(res);
}
