n = int(input())
s = input()
x = 0
mx = 0
for ch in s:
	if ch=='I':
		x += 1
		if x > mx:
			mx = x
	else:
		x -= 1
print(mx)