_ = raw_input() steps = raw_input() height = 0 num_valleys = 0 for step in steps: if step == 'D': if height == 0: num_valleys += 1 height -= 1 else: height += 1 print num_valleys