n=int(input())
s=input()
sl=list(s)

c=0
b=0
w=0
res=0
for i in range(n-1):
	if sl[i]=="#":
		b=b+1
	else:
		b=0

	if sl[i]=="#" and sl[i+1]==".":
		for j in range(1, n-i):
			if sl[i+j]==".":
				w=w+1
			else:
				break
		if b <= w:
			res=res+b
			b=0
			w=0
		else:
			res=res+w
			b=0
			w=0
print(res)
