from collections import Counter
n=int(input())
s=input()
B=True
if s=='.'*n:
    B=False
if B:
    num=list(s).index('#')
    plst=[]
    if num!=n-1:
        for i in range(num,n-1):
            if s[i]=='.' and s[i+1]=='#':
                l=n-i-1
            if s[i]=='#' and s[i+1]=='.':
                plst.append(i)
        moji=s[num:]
        moji+='.'
        lst=dict(Counter(moji).items())
        a=lst['#'];b=lst['.']
        if b==1:
            print(0)
        else:
            if s[-1]=='#':
                print(min(a-l,b-1))
            else:
                ans=min((n-plst[-1]-1)+len(plst)-1,min(a,b-1))
                print(ans)
    else:
        print(0)
else:
    print(0)