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

b,w = 0,0
for i in range(N):
    if S[i] == ".":
        S[i] = "W"
        w += 1
    else:
        S[i] = "B"
        b += 1

if S[N-2] == "B" and S[N-1] == "W":
    print(min(w,b))
elif S[N-1] == "B":
    print(min(w,b-1))
else:
    print(min(w,b))
