n = int(input()) s = input().strip() if n == 0: print(0) exit() # Count the number of runs and track the count of each color's runs runs = 1 current_color = s[0] color_run_counts = {current_color: 1} for c in s[1:]: if c != current_color: runs += 1 current_color = c if current_color in color_run_counts: color_run_counts[current_color] += 1 else: color_run_counts[current_color] = 1 # Calculate the number of colors with multiple runs k = sum(1 for cnt in color_run_counts.values() if cnt >= 2) # The answer is the number of runs minus k print(runs - k)