# TLEkuraisou 

n=int(input())
s=input()
sr=s[::-1]

black_sum=s.count("#")
white_sum=n-black_sum
black=0
white=0
for i in range(n):
    if s[i]==".":
        black=i
        
        break
#print("b:",black)
for i in range(n):
    if sr[i]=="#":
        white=i
        break
#print("w:",white)
ans=min(black_sum-black,white_sum-white)
print(ans)