#include<iostream>
using namespace std;
int main()
{
	int n,i,s=0,s2=0;
	cin>>n; 
	char a[n];
	cin>>a;
	for(i=0;i<n;i++)
	{
		if(a[i]=='I')s++;
		else if(a[i]=='D')s--;
		if(s2<s)s2=s;
	}
	cout<<s2<<endl;
} 