N = int(input())
S = input()

count = 0
ans = 0
revcount = 0
for i in range(N-1,-1,-1):
    if S[i] == ".":
        count+=1
        #revcount = 0
    else:
        revcount+=1
        ans+=count
        count=0
p = 0
for i in range(N-1,-1,-1):
    p+=1
    if S[i] == ".":
        break
    
#print(revcount,ans,N-p)
print(min(revcount,ans,S[:N-p].count("#")))
