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