input() steps = input() height = 0 v = 0 for step in steps: if step == 'U': height += 1 if height == 0: v += 1 elif step == 'D': height -= 1 print(v)