qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
n = int(input())
A = []
B = []

for _ in range(n):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

print(A)
A.reverse()
B.reverse()

ans = 0
for i in range(n):
    temp = B[i] - (A[i] % B[i])
    if temp == B[i]:
        temp = 0
    A = list(map(lambda x: x + temp, A))
    ans += temp

print(ans)

# Fixed code:
n = int(input())
A = []
B = []

for _ in range(n):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

A.reverse()
B.reverse()

ans = 0
for i in range(n):
    temp = B[i] - ((A[i]+ans) % B[i])
    if temp == B[i]:
        temp = 0
    ans += temp

print(ans)
# Buggy code:
n=int(input())
a=[]
b=[]
ret = 0
for i in range(n):
  a[i],b[i]=map(int,input().split())
for i in range(n):
  ret+=b[-1-i]-(ret+a[-1-i])%b[-1-i]
print(ret)

# Fixed code:
n=int(input())
a=[]
b=[]
ret = 0
for i in range(n):
  s,t=map(int,input().split())
  a+=[s]
  b+=[t]
for i in range(n):
  ret+=(b[-1-i]-(ret+a[-1-i])%b[-1-i])%b[-1-i]
print(ret)
# Buggy code:
N = int(input())
A=[]
B=[]
for i in range(N):
    a,b=[int(n) for n in input().split()]
    A.append(a)
    B.append(b)

cnt=0

# print(list(reversed(range(N))))
for i in reversed(range(N)):
    if A[i]%B[i]==0:
        r=0
    else
        r=B[i]-A[i]%B[i]
    cnt+=r
    A=[A[n]+r if n<=i else A[n] for n in range(N)]

print(cnt)


# Fixed code:
N = int(input())
A=[]
B=[]
for i in range(N):
    a,b=[int(n) for n in input().split()]
    A.append(a)
    B.append(b)

cnt=0

# print(list(reversed(range(N))))
for i in reversed(range(N)):
    if (A[i]+cnt)%B[i]==0:
        d=0
    else:
        d=B[i]-(A[i]+cnt)%B[i]
    cnt+=d
#    A=[A[n]+r if n<=i else A[n] for n in range(N)]

print(cnt)
# Buggy code:
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = A[::-1]
B = B[::-1]

ans = 0
for a, b in zip(A, B):
    a += ans
    m = b - (a % b) if b != 1 else 0
    m = b if a == 0
    ans += m
print(ans)

# Fixed code:
N = int(input())

A,B = [],[]

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
    
ans = 0
for a,b in zip(A[::-1],B[::-1]):
    if (ans+a)%b!=0: ans += b-((ans+a)%b)

print(ans)
# Buggy code:
a,b,c,d = map(int,input().split())

if a*b > c*d:
  print(a*b)
else:
  prnt(c*d)

# Fixed code:
a,b,c,d = map(int, input().split())
if a*b > c*d:
    print(a*b)
else:
    print(c*d)
# Buggy code:
a,b,c,d=map(int,input().split())
x=a*b,y=c*d
if x>=y:
  print(x)
else:
  print(y)

# Fixed code:
a,b,c,d=map(int,input().split())
x,y=a*b,c*d
if x>=y:
  print(x)
else:
  print(y)
# Buggy code:
  A, B, C, D = map(int, input().split())
  areaA = A*B
  areaB = C*D
  result = areaA if (areaA > areaB) else areaB
  print(result)

# Fixed code:
A, B, C, D = map(int, input().split())
areaA = A*B
areaB = C*D
result = areaA if (areaA > areaB) else areaB
print(result)
# Buggy code:
a = list(map(int,input().split()))
x = a[0] * a[1]
y = a[1] * a[2]
if x >= y:
  print(x)
else:
  print(y)

# Fixed code:
a = list(map(int,input().split()))
x = a[0] * a[1]
y = a[2] * a[3]
if x >= y:
  print(x)
else:
  print(y)
# Buggy code:
a,b,c,d = map(int,input().split())
print(max(a*b,d*d))

# Fixed code:
a,b,c,d = map(int,input().split())
print(max(a*b,c*d))
# Buggy code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    a, b, c, d = map(str, input().split())
    print(max(a*b, c*d))


if __name__ == "__main__":
    main()


# Fixed code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    a, b, c, d = map(int, input().split())
    print(max(a*b, c*d))


if __name__ == "__main__":
    main()
# Buggy code:
A, B, C, D = map(list(int, input().split()))

if A*B >= C*D:
	print(A*B)
else:
	print(C*D)

# Fixed code:
A, B, C, D = list(map(int, input().split()))

if A*B >= C*D:
	print(A*B)
else:
	print(C*D)
# Buggy code:
a = map(int, input().split())

b = a[0]*a[1] 
c = a[2]*a[3]
A = [b, c]
print(max(A))

# Fixed code:
a = list(map(int, input().split()))
b = a[0]*a[1] 
c = a[2]*a[3]
A = [b, c]
print(max(A))
# Buggy code:
A, B, C, D = map(int, input().split())
print(max(A, B), max(C, D))

# Fixed code:
A, B, C, D = map(int, input().split())
print(max(A*B, C* D))
# Buggy code:
a, b, c, d = map(int, input(),split())
print(max(a*b, c*d))

# Fixed code:
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))
# Buggy code:
a,b,c,d = map(int.input().split())
s1 = a*b
s2 = c*d
if s1 >= s2:
  print(s1)
else:
  print(s2)

# Fixed code:
a, b, c, d = map( int, input().split())
if a*b >= c*d:
    print(a*b)
else:
    print(c*d)
# Buggy code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

a,b,c.d = map(int,input().split())
print(max(a*b,c*d))

# Fixed code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

a,b,c,d = map(int,input().split())
print(max(a*b,c*d))
# Buggy code:
import math;
a,b,c,d=map(int,input().split())
print(math.max(a*b,c*d))

# Fixed code:
import math;
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))
# Buggy code:
A, B, C, D = map(int, input().split())

if A * B > C * D:
    print(A * B)
else:
    print(B * C)

# Fixed code:
A,B,C,D =map(int,input().split())

if A*B>C*D:
    print(A*B)

elif A*B<C*D:
    print(C*D)

else:
    print(A*B)
# Buggy code:
a,b,c,d=map(int.input().split())
if a*b>=c*d:
  print(a*b)
else:
  print(c*d)

# Fixed code:
a,b,c,d = map(int,input().split())
if a*b>c*d:print(a*b)
elif a*b==c*d:print(a*b)
else:print(c*d)
# Buggy code:
A, B, C, D = map(int, input().split())
print(max(A*B), max(C* D))

# Fixed code:
A,B,C,D=map(int, input().split());print(max(A*B,C*D))
# Buggy code:
a,b,c,d = map(int,input().split())
print(a*b if a*b > c*d else b*d)

# Fixed code:
a,b,c,d = map(int,input().split())
if a*b>=c*d:
  print(a*b)
else:
  print(c*d)
# Buggy code:
A,B,C,D = [int(i) for i in input().split()]

S1 = int(A*B)
S2 = int(C*D)

if S1 >= S2:
    print(S1)

if S2 >= S1:
    print(S2)


# Fixed code:
A,B,C,D = [int(i) for i in input().split()]

S1 = int(A*B)
S2 = int(C*D)

if S1 >= S2:
    print(S1)
elif S2 > S1:
    print(S2)
# Buggy code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

print(max(A*B, C*D))


# Fixed code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C, D = MAP()

print(max(A*B, C*D))
# Buggy code:
a,b,c,d = map(int(),input().split())

if a*b == c*d:
    print(a*b)
if a*b =< c*d:
    print(c*d)
if a*b >= c*d:
    print(a*b)




# Fixed code:
a, b, c, d = map(int, input().split())

if a*b > c*d:
  print(a*b)
elif a*b < c*d:
  print(c*d)
else:
  print(c*d)
# Buggy code:
a,b,c,d=map(int,input().split())
max(a*b,c*d)

# Fixed code:
a,b,c,d=map(int, input().split())

print(max(a*b, c*d))
# Buggy code:
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t = print(s)
else: print(t)

# Fixed code:
a,b,c,d = map(int, input().split())
s = a*b
t = c*d
if s > t: print(s)
else: print(t)
# Buggy code:
import sys
A,B,C,D = map(int,input().split())
if A > 10000 or B > 10000 or C > 10000 or D > 10000:
    sys.exit()
if A * B >= C * D:
    print(A*B)
if A * B <= C*D:
    print(C*D)

# Fixed code:
import sys
A,B,C,D = map(int,input().split())
if A > 10000 or B > 10000 or C > 10000 or D > 10000:
    sys.exit()
if A * B >= C * D:
    print(A*B)
    sys.exit()
if A * B <= C*D:
    print(C*D)
    sys.exit()
# Buggy code:
a,b,c,d = map(int,input().split())
print(max(a*b,c*d)

# Fixed code:
a,b,c,d=map(int,input().split())

print(max(a*b,c*d))
# Buggy code:
A,B,C,D=map(int,input().split().split().split())
x=(A*B)
y=(C*D)
if x>=y:
  print(x)
  else:
    print(y)

# Fixed code:
A,B,C,D=map(int, input().split())
if (A*B>=C*D):
 print(A*B)
else:
 print(C*D)
# Buggy code:
A,B,C,D=(int (i) for i in input() split())
print(max(A*B,C*D))

# Fixed code:
A,B,C,D=(int (i) for i in input(). split())
print(max(A*B,C*D))
# Buggy code:
a,b,c,d=map(int,input().split())
print(max(a*b),(c*d))

# Fixed code:
a, b, c, d = map(int,input().split());
print(max(a*b,c*d));
# Buggy code:
a,b,c,d=map(int,input().split())
if a*b <= c*d:
  print(a*b)
else:
  print(c*d)
  


# Fixed code:
a,b,c,d=map(int,input().split())
if a*b <= c*d:
  print(c*d)
else:
  print(a*b)
# Buggy code:
a, b, c, d = int(input().split())
x = a * b
y = c * d
if x == y:
  print(x)
elif x > y:
  print(x)
elif y > x:
  print(y)

# Fixed code:
a, b, c, d = map(int, input().split())
x = a * b
y = c * d
if x == y:
  print(x)
elif x > y:
  print(x)
elif y > x:
  print(y)
# Buggy code:
lengthArray = list(map(int,input().split()))

a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]

if a<b:
  print(a)
else:
  print(b)


# Fixed code:
lengthArray = list(map(int,input().split()))

a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]

if a<b:
  print(b)
else:
  print(a)
# Buggy code:
n = input()
s = input()

ans = 0
for i in s:
  if i == "I":
    cnt += 1
  else:
    cnt -= 1
  if ans < cnt:
    ans = cnt
print(ans)

# Fixed code:
n = input()
s = input()

ans = 0
cnt = 0
for i in s:
  if i == "I":
    cnt += 1
  else:
    cnt -= 1
  if ans < cnt:
    ans = cnt
print(ans)
# Buggy code:
N = int(input())
S = str(input())
count = 0
ans = 0

for i in range(N):
    if S[i:1] == "I":
        count += 1
        ans = max(ans,count)
    else:
        count -= 1

print(ans)

# Fixed code:
N = int(input())
S = str(input())
count = 0
ans = 0

for i in range(N):
    if S[i:i+1] == "I":
        count += 1
        ans = max(ans,count)
    else:
        count -= 1

print(ans)
# Buggy code:
import itertools

n = int(input())
s = list(input())
s1 = [1 if s[i] == 'I' else -1 for i in range(n)]
cumsum = list(itertools.accumulate(s1))
print(s1)
print(cumsum)
ans = max(cumsum)
print(max(ams, 0))

# Fixed code:
import itertools

n = int(input())
s = list(input())
s1 = [1 if s[i] == 'I' else -1 for i in range(n)]
cumsum = list(itertools.accumulate(s1))
ans = max(cumsum)
print(max(ans, 0))
# Buggy code:
N = int(input())
S = input()

x = 0
M = 0
for s in list(S):
  pre = x
  if s == "I":
    x += 1
  elif s == "D":
    x -= 1
  M = max(pre, x)
print(M)


# Fixed code:
N = int(input())
S = input()
 
x = 0
M = 0
for s in list(S):
  if s == "I":
    x += 1
  elif s == "D":
    x -= 1
  M = max(M, x)
print(M)
# Buggy code:
n = int(input())
s = list(input())
x = 0
l = []
for i in s:
   if i =="I":
      x += 1
   elif i =="D":
      x -= 1
   l.append(x)
print(max(l))

# Fixed code:
n = int(input())
s = list(input())
x = 0
l = []
l.append(x)
for i in s:
   if i =="I":
      x += 1
   elif i =="D":
      x -= 1
   l.append(x)
print(max(l))
# Buggy code:
N = int(input())
S = input()

ans = 0
x = 0
for s in S:
  v = 1 if s == 'I' else: 0
  x += v
  ans = max(ans, x)
print(ans)

# Fixed code:
N = int(input())
S = input()

ans = 0
x = 0
for s in S:
  v = 1 if s == 'I' else -1
  x += v
  ans = max(ans, x)
print(ans)
# Buggy code:
n=int(input())
s=input()
x=0
max=0
for i in range(n):
  if(s[i]=="D"):
    x-=1
  else:
    x+=1
    max=max([max,x])
print(max)

# Fixed code:
n=int(input())
s=input()
x=0
ma=0
for i in range(n):
  if(s[i]=="D"):
    x-=1
  else:
    x+=1
    ma=max([ma,x])
print(ma)
# Buggy code:
n=int(input())
s=input()
ans=0
x=[]
for i in range(n):
    if s[i]=='I':
        ans+=1
        x.append(ans)
    else:
        ans-=1
print(max(x))

# Fixed code:
n=int(input())
s=input()
li=[]
ans=0
li.append(ans)

for i in range(n):
    if s[i]=="I":
        ans+=1
    else:
        ans-=1
    li.append(ans)

print(max(li))
# Buggy code:
n = int(input())
s = input()
x = 0
i = 0
for i in range(len(s)):
  i = i + (s[i]=='I') - (s[i]=='D')
  x = max(x,i)
print(x)

# Fixed code:
n = int(input())
s = input()
x = 0
j = 0
for i in range(len(s)):
  j = j + (s[i]=='I') - (s[i]=='D')
  x = max(x,j)
print(x)
# Buggy code:
n = int(input())
s = str(input())

num = 0
res = 0

for i in range(len(s)):
  if str[i] == 'I':
    num += 1
  else:
    num -= 1
  if num > res:
    res = num

print(res)

# Fixed code:
n = int(input())
s = str(input())

num = 0
res = 0

for i in range(len(s)):
  if s[i] == 'I':
    num += 1
  else:
    num -= 1
  if num > res:
    res = num

print(res)
# Buggy code:
x=0
s_max = 0

n = int(input())
s = input()

for i in s:
    if i == "I":
        x += 1
    else:
        x -= 1
    x_max = max(x_max,x)

print(x_max)

# Fixed code:
x=0
x_max = 0

n = int(input())
s = input()

for i in s:
    if i == "I":
        x += 1
    else:
        x -= 1
    x_max = max(x_max,x)

print(x_max)
# Buggy code:
n = int(input())
s = list(input())
ans,box = 0,[]
for i in range(n):
  if s[i] == "I":
    ans += 1
  else:
    ans -= 1
  box.append(ans)
print(max(box))

# Fixed code:
n = int(input())
s = list(input())
ans,box = 0,[]
box.append(ans)
for i in range(n):
  if s[i] == "I":
    ans += 1
  else:
    ans -= 1
  box.append(ans)
print(max(box))
# Buggy code:
#n,l = map(int,input().split())
#l = kist(input())

l = kist(input())
cnt=0
ans=0

for i in range(n):
    if l[i]=='I':
        cnt+=1
    else:
        cnt-=1
    ans = max(ans,cnt)

print(ans)

# Fixed code:
#n,l = map(int,input().split())
#l = kist(input())

n = int(input())
l = list(input())
cnt=0
ans=0

for i in range(n):
    if l[i]=='I':
        cnt+=1
    else:
        cnt-=1
    ans = max(ans,cnt)

print(ans)
# Buggy code:
# coding: utf-8
import time
import re
import math

def main():
    n=int(input())
    s=input()
    x=0
    mx=0
    for a in s:
        if(a=='I'):x+=1
        elif(a=='D'):x-=1

        mx=max([mx,x])

main()

# Fixed code:
# coding: utf-8
import time
import re
import math

def main():
    n=int(input())
    s=input()
    x=0
    mx=0
    for a in s:
        if(a=='I'):x+=1
        elif(a=='D'):x-=1

        mx=max([mx,x])
    print(mx)
main()
# Buggy code:
N = int(input())
S = input()
x = 0
length = len(S)
List = [0]
for i in range(length):
  if(S[i] == I):
    x += 1
    List.append(x)
  else:
    x -= 1
    List.append(x)
print(max(List))

# Fixed code:
N = int(input())
S = input()
x = 0
length = len(S)
List = [0]
for i in range(length):
  if(S[i] == "I"):
    x += 1
    List.append(x)
  else:
    x -= 1
    List.append(x)
print(str(max(List)))
# Buggy code:
A = int(input())
S = input()
s = -1
count = 0
for i in S:
  if (s<=count)and(i == 'I'):
    count += 1
    s = count
  elif i == 'I':
    count += 1
  else:
    count += -1
print(s)

# Fixed code:
A = int(input())
S = input()
s = 0
count = 0
for i in S:
  if (s<=count)and(i == 'I'):
    count += 1
    s = count
  elif i == 'I':
    count += 1
  else:
    count += -1
print(s)
# Buggy code:
n =int(input())
s = input()
x = 0
for i in s:
  if i ="I": 
    x =max(x,x+1)
  else:
    x =max(x,x-1)
print(x)

# Fixed code:
n =int(input())
s = input()
x,ans =0,0
for i in s:
  if i =="I":
    x +=1
    ans =max(x,ans)
  else:
    x-=1
    ans =max(x,ans)
print(ans)
# Buggy code:
if __name__ == '__main__':
    a = int(input())
    s = input()
    count =0
    for i in s:
        if i == "I":
            count +=1
        else:
            count -=1
    print(count)
        

# Fixed code:
if __name__ == '__main__':
    a = int(input())
    s = input()
    count =0
    max = 0
    for i in s:
        if i == "I":
            count +=1
        else:
            count -=1

        if max < count:
            max = count
    print(max)
# Buggy code:
n = int(input())
s = input()
x = 0
X = [0]
for i in range(n):
  if s[0]=="I":
    x+=1
    X.append(x)
  else:
    x-=1
    X.append(x)
print(max(X))

# Fixed code:
n = int(input())
s = input()
x = 0
X = [0]
for i in range(n):
  if s[i]=="I":
    x+=1
    X.append(x)
  else:
    x-=1
    X.append(x)
print(max(X))
# Buggy code:
n=int(input())
s=input()
k=0
for i in range(n):
    if s[i]=="I":
        x+=1
        if x>k:
            k=x
    else:
        x+=-1
print(k)

# Fixed code:
n=int(input())
s=input()
k=0
x=0
for i in range(n):
    if s[i]=="I":
        x+=1
        if x>k:
            k=x
    else:
        x+=-1
print(k)
# Buggy code:
n = int(input())
s = input()

mx = n
current = n
for c in s:
  if c == "I":
    current += 1
  elif c == "D":
    current -= 1
  if current > mx:
    mx = current


print(mx)
  
  

# Fixed code:
n = int(input())
s = input()
 
mx = 0
current = 0
for c in s:
  if c == "I":
    current += 1
  elif c == "D":
    current -= 1
  if current > mx:
    mx = current
 
 
print(mx)
# Buggy code:
N = int(input())
S = input()

ans = 0
highest = 0
for i in S:
    if i == "I":
        ans += 1
    else:
        ans -= 1
    print(ans)
    if highest <= ans:
        highest = ans 

print(highest)

# Fixed code:
N = int(input())
S = input()

ans = 0
highest = 0
for i in S:
    if i == "I":
        ans += 1
    else:
        ans -= 1
    if highest <= ans:
        highest = ans 

print(highest)
# Buggy code:
n = int(input())
s = input()
x = 0
m = [0,]

def incre():
    for i in range(len(s)):
        if s[i] == 'I':
            x += 1
            m.append(x)
        elif s[i] == 'D':
            x -= 1
            m.append(x)
    else:
        print(max(m))

if __name__ == "__main__":
    incre()

# Fixed code:
def incre():
    n = int(input())
    s = input()
    x = 0
    m = [0,]
    for i in range(len(s)):
        if s[i] == 'I':
            x += 1
            m.append(x)
        elif s[i] == 'D':
            x -= 1
            m.append(x)
    else:
        print(max(m))

if __name__ == "__main__":
    incre()
# Buggy code:
N = int(input())
S = input()
res = 0
x = 0
for i in range(N):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  res = max(res, x)
return res

# Fixed code:
N = int(input())
S = input()
res = 0
x = 0
for i in range(N):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  res = max(res, x)
print(res)
# Buggy code:
n = input()
s = input()
x = 0
for chara in s:
  if(chara == "I"):
    x += 1
  else:
    x -=1
print(x)

# Fixed code:
n = input()
s = input()
max_x = 0
x = 0
for chara in s:
  if(chara == "I"):
    x = x + 1
  else:
    x = x - 1
  if(max_x < x):
    max_x = x
print(max_x)
# Buggy code:
N = int(input())
S = input()
ans = []
num = 0
for i in S:
    if i == 'I':
        num += 1
    else:
        num -= 1
    ans.append(num)
print(max(ans))

# Fixed code:
N = int(input())
S = input()
ans = []
num = 0
for i in S:
    if i == 'I':
        num += 1
    else:
        num -= 1
    ans.append(num)
print(max(max(ans), 0))
# Buggy code:
n = int(input())
s = input()
x = m = 0
for i range(n): x += [-1,1][s[i] == I]; m = max(m,x)
print(m)

# Fixed code:
n = int(input())
s = input()
x = m = 0
for i in range(n): x += [-1,1][s[i] == "I"]; m = max(m,x)
print(m)
# Buggy code:
n = int(input())
s = list(input())
ans=0
tmp = 0
for i in range(n):
    if s[i] == 'D':
        tmp += 1
    else:
        tmp -= 1
    ans = max(ans,tmp)
print(ans)


# Fixed code:
n = int(input())
s = list(input())
ans=0
tmp = 0
for i in range(n):
    if s[i] == 'I':
        tmp += 1
    else:
        tmp -= 1
    ans = max(ans,tmp)
print(ans)
# Buggy code:
N=int(input())
S=input()
ans = 0
a = 0
for i in list(S):
  if i=="I":
    ans += 1
    a = max(ans, a)
  else:
    ans -= 1
    
print(ans)

# Fixed code:
N=int(input())
S=input()
ans = 0
a = 0
for i in list(S):
  if i=="I":
    ans += 1
    a = max(ans, a)
  else:
    ans -= 1
    
print(a)
# Buggy code:
N = int(input())
S = input()

x = 0
maxCount = 0
for s in S:
  former = x
  if s == "I":
    x += 1
  elif s == "D":
    x -= 1
  
  maxCount = max(former, x)
  
print(maxCount)

# Fixed code:
N = int(input())
S = input()

x = 0
maxCount = x
for s in S:
  if s == "I":
    x += 1
  elif s == "D":
    x -= 1
  
  maxCount = max(maxCount, x)
  
print(maxCount)
# Buggy code:
import sys

N = int(input())
A = [int(i) for i in input().split()]
A.sort()

if N % 2 != 0:
    if A[0] == 0:
        a = A[1:]
        j = 1
        for i in range(0, N//2 + 1, 2):
            if a[i] == a[i+1] == 2*j:
                j += 1
            else:
                print(0)
                sys.exit()
        print((2**(N//2)) % (10**9+7))
        
    else:
        print(0)
else:
    j = 1
    for i in range(0, N//2+1, 2):
        if A[i] == A[i+i] == 2*j -1:
            j += 1
        else:
            print(0)
            sys.exit()
    print((2**(N//2)) % (10**9+7))

# Fixed code:
import sys

N = int(input())
A = [int(i) for i in input().split()]
A.sort()

if N == 1:
    if A[0] == 0:
        print(1)
        sys.exit()
    else:
        print(0)
        sys.exit()
        
if N % 2 != 0:
    if A[0] == 0:
        a = A[1:]
        j = 1
        k = 0
        for i in range(0, N//2 + 1, 2):
            if a[k] == a[k+1] == 2*j:
                j += 1
                k += 2
            else:
                print(0)
                sys.exit()
        print((2**(N//2)) % (10**9+7))
        
    else:
        print(0)
else:
    j = 1
    k = 0
    for i in range(0, N//2 + 1, 2):
        if A[k] == A[k+1] == 2*j -1:
            j += 1
            k += 2
        else:
            print(0)
            sys.exit()
    print((2**(N//2)) % (10**9+7))
# Buggy code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==0:
  for i in range(n):
    if a[i]!=i//2+1:
      print(0)
      exit()
  print(2**(n//2))
else:
  for i in range(n):
    if a[i]!=i//2+2:
      print(0)
      exit()
  print(2**(n//2))

# Fixed code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
jun=1
if n%2==0:
  for i in range(n//2):
    if a[2*i] != 2*i+1 or a[2*i+1] != 2*i+1:
      print(0)
      exit()
    jun = jun*2%1000000007
  print(jun)
else:
  if n==1:
    if a[0]==0:
      print(1)
    else:
      print(0)
  else:
    for i in range(n//2):
      if a[2*i+1] != 2*(i+1) or a[2*i+2] != 2*(i+1):
        print(0)
        exit()
      jun = jun*2%1000000007
    print(jun)
# Buggy code:
N = int(input())
A = list(map(int, input().split()))

from collections import Counter

ctr = Counter(A)

if N % 2 and ctr[0] != 1:
    print(0)
    exit()

if N % 2 == 0:
    for i in range(2, N ,2):
        if ctr[i] != 2:
            print(0)
            exit()
else:
    for i in range(1, N, 2):
        if ctr[i] != 2:
            print(0)
            exit()

MOD = 10 ** 9 + 7
ans = 2 ** (N//2) % MOD
print(ans)

# Fixed code:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
ctr = Counter(A)
if N%2:
    if ctr[0] != 1:
        print(0)
        exit()
    for i in range(2,N,2):
        if ctr[i] != 2:
            print(0)
            exit()
else:
    for i in range(1,N,2):
        if ctr[i] != 2:
            print(0)
            exit()
print(2**(N//2) % MOD)
# Buggy code:
n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 0:
  if a == sorted(2*[2*x+1 for x in range(n/2)]):
    print(2**(n/2))
  else:
    print(0)
else:
  if a == sorted(list(2*[2*x for x in range(n//2+1)])[1:]):
    print(2**(n//2))
  else:
    print(0)

# Fixed code:
n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 0:
  if a == sorted(2*[2*x+1 for x in range(int(n/2))]):
    print((2**int(n/2))%1000000007)
  else:
    print(0)
else:
  if a == sorted(list(2*[2*x for x in range(n//2+1)])[1:]):
    print((2**(n//2))%1000000007)
  else:
    print(0)