N=int(input())

c="$"
lg=0
ou=[]

for s in input():
	if s == c:
		lg += 1
	else:
		ou.append((c, lg))
		lg = 1
		c = s

ou.pop(0)
ou.append((c, lg))

ans=0
b=(".",0)
for s,l in ou:
	bs,bl = b
	if bs == "#" and s == ".":
		ans += min(bl, l)
	b = (s,l)

print(ans)
