n=int(input())
s=list(input())
ans=0
now="."
stack=[]
for i in s:
  if i=="#":
    ans+=min(stack.count("#"),stack.count("."))
    stack=[]
    stack.append(i)
  else:
    stack.append(i)
ans+=min(stack.count("#"),stack.count("."))
print(ans)