# TLEkuraisou 

n=int(input())
s=input()
ss=s
cnt=0
for i in range(n):
    a=s.count(".#")
    if a==0:
        break
    cnt+=a
    s=s.replace(".#","..")
cnt2=0
for i in range(n):
    aa=ss.count(".#")
    if aa==0:
        break
    cnt2+=aa
    ss=ss.replace(".#","##")
    


print(min(cnt,cnt2))