#include<iostream>
using namespace std;
int n,high,maxh;
char s;
int main()
{
	cin>>n;
	while(n--)
	{
		cin>>s;
		if(s=='I') high++;
		else high--;
		if(high>maxh) maxh=high;
	}
	cout<<maxh<<endl;
	return 0;
}