n=int(input())
l=input()
l1=[]
l2=[]
rw=0
lb=0
for i in range(n):
  if l[i]=="#":
    lb+=1
  l1.append(lb)
  if l[n-1-i]==".":
    rw+=1
  l2.append(rw)
l2=l2[::-1]
l3=[]
for i in range(n):
  l3.append(l1[i]+l2[i])
print(min(min(l3),len(l)-rw,len(l)-lb))