# Enter your code here. Read input from STDIN. Print output to STDOUT n=int(raw_input()) arr=map(str,raw_input().strip()) l=0 j=0 for i in range(0,n): c=0 c=c+j if arr[i]=="D": j=j-1 else: j=j+1 if j==0 and c<0: l=l+1 print l