#include<bits/stdc++.h>
using namespace std;

int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

int main(){

    int n,ss,k=0,m=0;
    string s;

    cin>>n;

    getchar();

    cin>>s;
    ss = s.size();
    for(int i=0 ; i<ss; i++){
        if(s[i]=='I') k++;
        else k--;
        m = max(m,k);
    }

    cout<<m<<"\n";

}

