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