N=int(input())
S=list(input())
flag=0
countB=0
for i in range(N):
  if S[i]=="#":
    if flag==0:
      Nint=i
      flag=1
    countB += 1
if flag==1:
  countW=N-Nint-countB
  if countB>countW:
    print(countW)
  else:
    print(countB)
else:
  print(0)