n=int(input())
s=int(input())
c=[]
for i in range(n-1):
	if s[i+1]!=s[i]:
		c.append(i)
if s[0]=="#":
	for i in range(int(c/2)):
		ans+=s[2*i+1]-s[2*i]
else:
	for i in range(int(c/2)-1):
		ans+=s[2*i+2]-s[2*i+1]
return ans