n = int(input())
s = input()

if "." not in s or "#" not in s:
    print(0)
    exit()

f,f2 = 0,0
res,res2 = 0,0
for i,j in zip(s,reversed(s)):
    if f == 1 and i==".":
        res += 1
    if i=="#":
        f = 1
    if f2 == 1 and j=="#":
        res2 += 1
    if j==".":
        f2 = 1

else:
    print(min(res,abs(n-res)-1,res2,abs(n-res2)-1))
