n = int(input()) steps = input() height = 0 valley = 0 for i in range(len(steps)): if steps[i]=="D": height -= 1 else: height += 1 if height == 0: valley += 1 print(valley)