#include <bits/stdc++.h>
int main(void)
{
	int h,max(0);
	scanf("%d",&h);
	h=0;
	char c;
	getchar();
	while(scanf("%c",&c)!=EOF)
		max=std::max(max,h+=(c=='I'?1:-1));
	printf("%d\n",max);
	return 0;
}