n=int(input())
s=input()
a=[]
for i in range(n):
    if i==0:
        if s[0]=="#":
            a.append(1)
        else:
            a.append(0)
    else:
        if s[i]=="#":
            a.append(a[i-1]+1)
        else:
            a.append(a[i-1])
min=n
for i in range(n):
    m=a[i]
    r=n-i-1-(a[n-1]-a[i])
    q=m+r
    if q<min:
        min=q
if a[n-1]==n:
    min=0
print(min)