n=int(input())
s=list(input())
h=0
b=0
for i in range(n):
    if s[i]=="#":
        b+=1
    elif s[i]=="." and b!=0:
        h+=1
b2=0
h2=0
for i in range(n-1,-1,-1):
    if s[i]==".":
        h2+=1
    elif s[i]=="#" and h2!=0:
        b2+=1


print(min(h,b2))