n=int(input())

s=input()


flg=0
shiro=0
kuro=0
bef="."
ans=0
for i in range(n):
  if bef=="#" and s[i]==".":
    flg=1
  
  if bef=="." and s[i]=="#" and flg==1:
    ans+=min(shiro,kuro)
    shiro=0
    kuro=0
    flg=0
  else:
    if s[i]=="#":
      kuro+=1
    else:
      shiro+=1
  bef=s[i]

if flg==1:
  ans+=min(shiro,kuro)


print(ans)