# Enter your code here. Read input from STDIN. Print output to STDOUT n = int(raw_input()) steps = raw_input() level = 0 sum = 0 for i in range(n): if steps[i] == "U": level += 1 if level == 0: sum += 1 elif steps[i] == "D": level -= 1 print sum