n=int(input())
s=input()
for i in s[::-1]:
    if i=="#":
        s=s[:-1]
    else:
        break
if len(set(list(s)))<=1:
    print(0)
    exit()    
print(min(s[min(0,s.index("#")):].count("."),s.count("#")))