n=int(input())
s=list(input())

b=s.count('#')
w=s.count('.')

ans=0
sflag=False
pflag=False
snum=0
pnum=0

for i in range(n):
    if s[i] == '#' and sflag and pflag:
        ans+=min(snum,pnum)
        snum=0
        pnum=0
        sflag=False
        pflag=False

    elif s[i] == '#':
        sflag = True
        snum+=1

    elif sflag == True and s[i] == '.':
        pflag=True
        pnum+=1

    elif ans>=b or ans>=w:
        break

#print(min(b,w))
print(min(b,w,ans+pnum))
