n = int(input()) s = input().strip() # Check if all characters are the same if all(c == s[0] for c in s): print(1) else: dp = [0] * (n + 1) last = {'R': -1, 'G': -1, 'B': -1} for i in range(n): c = s[i] option1 = dp[i] + 1 if last[c] == -1: option2 = float('inf') else: option2 = dp[last[c] + 1] + 1 dp[i + 1] = min(option1, option2) last[c] = i print(dp[n])