N = int(input())
S = input()

count = 0
sList = list(S)
bi = N
wi = -1

def funcCheck(li):
    s = li[0]
    for i in range(len(li)-1):
        if li[i+1] != s:
            break
    if len(set(li[i+1:])) <= 1:
        return True
    else:
        return False
    

for i in range(N):
    if funcCheck(sList[wi+1:bi]):
        break
    while True:
        bi -= 1
        if sList[bi] == ".":
            sList[bi] = "#"
            count += 1
            break
    if funcCheck(sList[wi+1:bi]):
        break
    while True:
        wi += 1
        if sList[wi] == "#":
            sList[wi] = "."
            count += 1
            break

print(count)