n = int(input())
s = input()
try:
  leftb = s.index('#')
except:
  leftb = -1
try:
  rightw = s[::-1].index('.')
except:
  rightw = -1

if leftb < 0 or rightw < 0:
  print(0)
else:
  w = s[leftb:].count('.')
  b = s[leftb:].count('#') - rightw
  ans = min(w,b)
  print(max(0, ans))