#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    int x=0;
    char a;
    int M=0;
    while(t--)
    {
        cin>>a;
        if(a=='I')
        {
            x++;
            if(x>M) M=x;
        }
        else if(a=='D')
            x--;
    }
    cout<<M<<endl;
    return 0;
}
