N=int(input())
S=input()
m=S[::-1]
c=S.count('#')
if ('.' in S) & ('#' in S):
	p=S.index('#')
	l=m.index('.')
	k=S[p::]
	a=k.count('.')
	if (p!=0)&(a==0):
		print(0)
	elif a>=c-l:
		 print(c-l)
	else:
		 print(a)
else:
	print(0)