N = int(input())
def runLength(s):
  if len(s) == 0: return []
  if len(s) == 1: return [(s, 1)]
  res = []
  lc = 1
  for i in range(1, len(s)):
    if s[i-1] == s[i]:
      lc += 1
    else:
      res.append((s[i-1], lc))
      lc = 1
  res.append((s[i], lc))
  return res

ans = 0
S = runLength(input())

for i in range(1, len(S)):
  if S[i-1][0] == "#" and S[i][0] == ".":
    ans += min(S[i-1][1], S[i][1])
print(ans)