n = int(input())
s = input()
siro = s.count(".")
ren = 0
i = 1
while i <= n :
    if s[-i] == "#" :
        ren += 1
        i += 1
    else :
        break
ku = 0
if n-siro >= 1:
    ku = s.index("#")
print(min(siro,n-ren-siro,s[ku:].count(".")))
