n = int(input())
s = str(input())
s += "#"
b = 0
w = 0
ans = 0
for s_ in s:
  if s_ == "#":
    if w == 0:
      b = b + 1
    else:
      ans = ans + min(b,w)
      b = 1
      w = 0
  if s_ == ".":
    if b > 0:
      w = w + 1

print(ans)