from copy import copy

def rewrite_B(S):
    output = 0
    for i in range(1,len(S)):
        if S[i-1] == "B" and S[i] == "W":
            S[i] = "B"
            output += 1
    return output

def rewrite_W(S):
    output = 0
    for i in reversed(range(1,len(S))):
        if S[i-1] == "B" and S[i] == "W":
            S[i-1] = "W"
            output += 1
    return output

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

for i in range(N):
    if S[i] == ".":
        S[i] = "W"
    else:
        S[i] = "B"

a,b = rewrite_B(copy(S)),rewrite_W(copy(S))
print(min(a,b))
