# Enter your code here. Read input from STDIN. Print output to STDOUT n = int(raw_input()) s = list(str(raw_input())) level = 0 count = 0 for c in s: if level == 0 and c == 'D': count += 1 if c == 'D': level += 1 else: level -= 1 print count