N=int(input())
S=input()
S=S+'#'
sc=0
tc=0
ans=0
for i in range(N+1):
    if(tc!=0 and S[i]=='#'):
        if(sc<tc):
            ans+=sc
            sc=0
        else:
            ans+=tc
            sc+=tc
        tc=0
    if(sc!=0 and S[i]=='.'):
        tc+=1
    elif(tc==0 and S[i]=='#'):
        sc+=1
print(str(ans))