#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,count=0,MAX=0;
	cin>>x;
	char s[x];
	for(int i=0;i<x;i++){
	cin>>s[i];
	if(s[i]=='I')
	count++;
	else
	count--;
	if(count>MAX)
	MAX=count;
	}
	
cout<<MAX;	
}