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"

S1,S2 = copy(S),copy(S)
print(min(rewrite_B(S1),rewrite_W(S2)))
