#include<iostream>
#include<algorithm>
using namespace std;
int n,maxn,ans;
char x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x=='I')++ans;
		if(x=='D')--ans;
		maxn=max(maxn,ans);
	}
	cout<<maxn<<endl;
}