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

b = 0
w = 0
ans = 0
for s_ in s:
  if w == 0 and s_ == "#":
    b = b + 1
  elif w > 0 and s_ == "#":
    ans = ans + min(b,w)
    b = 1
    w = 0
  if b > 0 and s_ == ".":
    w = w + 1
if w > 0:
  ans = ans + min (b,w)

print(ans)