n = int(input())
s = input()

k=0
j=0
for i in range(n-1):
	if s[n-1-i] == '.' and  s[n-2-i] =='#':
		k = n-1-i
		break
for i in range(n):
	if s[:i]!='.'*(i+1):
		j=i
		break

print( min( len( s[:k].replace('.','') ), len( s[j:].replace('#',''))  ))
