N = int(input())
S = list(input())
c = 0
a = 0
cw = [0] * N
cb = [0] * N
tw = 0
tb = 0
for i in range(N):
    if S[i] == '.':
        tw += 1
        cw[i] = tw
        cb[i] = tb
    else:
        tb += 1
        cb[i] = tb
        cw[i] = tw
tw = 0
tb = 0
A = 0
for i in reversed(range(N)):
    if S[i] == '.':
        if cb[i] <= cw[i]:
            a += cb[i]
            print(a)
            exit()
        else:
            a += 1
print(a)
