# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  S = input()

  current = '#'
  counts = {"#": 0, ".": 0}
  ans = 0
  for c in S:
    if c != current:
      current = c
      if current == '#':
        ans += min(counts["#"], counts["."])
        counts = {"#": 0, ".": 0}
    counts[c] += 1

  if current == ".":
    ans += min(counts["#"], counts["."])

  print(ans)

if __name__ == "__main__":
  main()
