N=int(input())
S=input()
cur=0
lis=["" for i in range(N)]
lis[cur]=S[0]
for c in S[1:]:
	ss=lis[cur]
	if c==".":
		lis[cur]=ss+"."
	else:
		if ss[-1]=="#":
			lis[cur]=ss+"#"
		else:
			cur+=1
			lis[cur]="#"
def counting(sss):
	curb=sss.find("#")
	curw=sss.rfind(".")
	return min(sss[:curw+1].count("#"),sss[curb:].count("."))

c=0
for l in lis:
	if l=="":
		break
	else:
		a=counting(l)
		c+=a
print(c)