n=int(input())
s=input()
a=[]
c=[]
b,w=0,0
for i in range(n):
    if s[i]=='#':
        b+=1
    else:
        w+=1
    a.append([b,w])
wa=a[-1][1]
for i in range(n):
    c.append(a[i][0]+wa-a[i][1])
print(min(min(c),abs(n-wa)))