n = int(input())
s = input()
ib = s.find('#')
ibr = s.rfind('#')
iw = s.rfind('.')
if iw < ibr:
  print('0')
  exit()
cw = s[ib:].count('.')
cb = s.count('#')
if ib == -1 or ib == n:
	print('0')
elif cw >= cb and cw >= cb - (n - 1 -iw):
	print(cb)
else:
	print(cw)