문제 주소: https://www.acmicpc.net/problem/20365
난이도: silver 2
#딕셔너리를 이용해서 작업횟수 기록
#B는 B로 몇번 바꿔 칠해야하는지, R은 R로 몇번 바꿔 칠해야하는지 기록
color_dict = {'B' : 0, 'R' : 0}
#첫번째 문자 count
color_dict[tasks[0]] += 1
#칠해야하는 색이 바뀌면 새로운 색에 +1 해줌
for i in range(1, N):
if tasks[i] != tasks[i-1]:
color_dict[tasks[i]] += 1
import sys
input = sys.stdin.readline
N = int(input())
tasks = input().rstrip()
color_dict = {'B' : 0, 'R' : 0}
color_dict[tasks[0]] += 1
for i in range(1, N):
if tasks[i] != tasks[i-1]:
color_dict[tasks[i]] += 1
print(min(color_dict['R'], color_dict['B']) + 1)