#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0,s=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		char t;
		cin>>t;
		if(t=='I')s++;
		else s--;
		ans=max(ans,s);
	}
	cout<<ans<<"\n";
	return 0;
}