#include<bits/stdc++.h>
using namespace std;
int main()
{
int now=0,maxs=0;
int n;
cin>>n;
char s;
while(n--)
{
	cin>>s;
	if(s=='I')
	{
		now++;
		maxs=max(now,maxs);
	}
	else
	{
		now--;
	}
}
cout<<maxs<<endl;
}