n=int(eval(input()))

s=eval(input())

x=0

mayor=0

for i in range(n):

  if s[i]=="I":

    x+=1

  elif s[i]=="D":

    x-=1

  if x>mayor:

    mayor=x

print(mayor)
#!/usr/bin/env python

count = input()

s = input()

max, sum = 0, 0



for each_char in s:

	if each_char == 'I':

		sum += 1

	else:

		sum -= 1

	if max < sum:

		max = sum

print(max)
n = int(eval(input()))
s = eval(input())
x = 0
mayor = 0
for i in range(n):
    if s[i] == "I":
        x += 1
    elif s[i] == "D":
        x -= 1
    if x > mayor:
        mayor = x
print(mayor)

#!/usr/bin/env python
count = input()
s = input()
max, sum = 0, 0
for each_char in s:
    if each_char == "I":
        sum += 1
    else:
        sum -= 1
    if max < sum:
        max = sum
print(max)

-n = int(eval(input())) -s = eval(input()) -x = 0 -mayor = 0 -for i in range(n): -    if s[i] == "I": -        x += 1 -    elif s[i] == "D": -        x -= 1 -    if x > mayor: -        mayor = x -print(mayor) +#!/usr/bin/env python +count = input() +s = input() +max, sum = 0, 0 +for each_char in s: +    if each_char == "I": +        sum += 1 +    else: +        sum -= 1 +    if max < sum: +        max = sum +print(max)