n = int(input()) s = input().strip() if n == 0: print(0) exit() # Split the string into runs runs = [] current = s[0] for c in s[1:]: if c != current: runs.append(current) current = c runs.append(current) # Count the frequency of each run's color from collections import defaultdict freq = defaultdict(int) for c in runs: freq[c] += 1 max_freq = max(freq.values()) answer = (len(runs) - max_freq) + 1 print(answer)