n=int(input())
s=list(input())
count=0
now=0
for i in range(n,0,-1):
  if s[i]=="#":
    count=count+1
  else:
    count1=count1+1
  if count<count1:
    now=i-1
    break
for i in range(now,0,-1):
  if s[i]=="#":
    count=count+1
print(count)