N = int(input())
S = input()
w = 0
res = 0
save = 0
b = 0
for s in reversed(S):
  if s == '.':
    if 0 < b:
      res += min(save, b)
      b = 0
      save = 0
      w = 0
    w += 1
  else:
    if 0 < w:
      save = w
      b += 1

if s == '#':
  res += min(save, b)

print(res)