output_description: Print the maximum value taken by x during the operations.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      S
attempt: import sys, collections as cl, bisect as bs
  
  sys.setrecursionlimit(100000)
  input = sys.stdin.readline
  mod = 10**9 + 7
  Max = sys.maxsize
  
  
  def l():  # intのlist
      return list(map(int, input().split()))
  
  
  def m():  # 複数文字
      return map(int, input().split())
  
  
  def onem():  # Nとかの取得
      return int(input())
  
  
  def s(x):  # 圧縮
      a = []
      if len(x) == 0:
          return []
      aa = x[0]
      su = 1
      for i in range(len(x) - 1):
          if aa != x[i + 1]:
              a.append([aa, su])
              aa = x[i + 1]
              su = 1
          else:
              su += 1
      a.append([aa, su])
      return a
  
  
  def jo(x):  # listをスペースごとに分ける
      return " ".join(map(str, x))
  
  
  def max2(x):  # 他のときもどうように作成可能
      return max(map(max, x))
  
  
  def In(x, a):  # aがリスト(sorted)
      k = bs.bisect_left(a, x)
      if k != len(a) and a[k] == x:
          return True
      else:
          return False
  
  
  def pow_k(x, n):
      ans = 1
      while n:
          if n % 2:
              ans *= x
          x *= x
          n >>= 1
      return ans
  
  
  """
  def nibu(x,n,r):
      ll = 0
      rr = r
      while True:
          mid = (ll+rr)//2
  
      if rr == mid:
          return ll
      if (ここに評価入れる):
          rr = mid
      else:
          ll = mid+1
  """
  
  n = onem()
  
  po = input()[:-1]
  ma = 0
  co = 0
  
  for a in po:
      if a == "I":
          co += 1
      else:
          co -= 1
      ma = max(ma, co)
  print(ma)
  
problem_description: Statement
  
  You have an integer variable x. Initially, x=0.
  
  Some person gave you a string S of length N, and using the string you
  performed the following operation N times. In the i-th operation, you
  incremented the value of x by 1 if S_i=`I`, and decremented the value of x by
  1 if S_i=`D`.
  
  Find the maximum value taken by x during the operations (including before the
  first operation, and after the last operation).
samples: [{"input": "5\n    IIDID", "output": "2\n    \n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively.\nThus, the output should be 2, the maximum value.\n\n* * *"}, {"input": "7\n    DDIDDII", "output": "0\n    \n\nThe initial value x=0 is the maximum value taken by x, thus the output should\nbe 0."}]