output_description: Print the minimum number of stones that needs to be recolored.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S
attempt: N = int(input())
  S = input()
  # . = しろ
  # # = 黒
  # #の横に.がないようにしたい
  # #の横に.があったら#を.に変える
  # or #の横に.があったら.を#に変える
  
  # when do you replace now char to .
  #
  
  # テストケース
  """
  9
  .#.#.#.#.
  """
  # => .....# = 2
  
  
  def inorderReplace(S, N):
      S = list(S)
      cnt = 0
      for i in range(N - 1):
          nowChar = S[i]
          nextChar = S[i + 1]
          if nowChar == "#" and nextChar == ".":
              cnt += 1
              S[i + 1] = "#"
      return cnt
  
  
  def calcCount(S, N):
      countingChar = S[0]
      rst = []
      count = 1
      for s in S[1:]:
          if countingChar == s:
              count += 1
          else:
              rst.append((countingChar, count))
              count = 1
              countingChar = s
      rst.append((countingChar, count))
      return rst
  
  
  def countRightChange(countingList):
      # 全部を.に変えるコスト
      cnt = 0
      for elem in countingList:
          if elem[0] == "#":
              cnt += elem[1]
      return cnt
  
  
  def countLeftChange(countingList):
      # 全部を#に変えるコスト
      cnt = 0
      for elem in countingList:
          if elem[0] == ".":
              cnt += elem[1]
      return cnt
  
  
  def calcPoint(countingList):
      minVal = 9999999999999
      for i in range(len(countingList)):
          a = countRightChange(countingList[:i])
          b = countLeftChange(countingList[i:])
          if minVal > a + b:
              minVal = a + b
      return minVal
  
  
  # cnt = inorderReplace(S , N)
  countingList = calcCount(S, N)
  cnt2 = calcPoint(countingList)
  
  print(cnt2)
  
problem_description: Statement
  
  There are N stones arranged in a row. Every stone is painted white or black. A
  string S represents the color of the stones. The i-th stone from the left is
  white if the i-th character of S is `.`, and the stone is black if the
  character is `#`.
  
  Takahashi wants to change the colors of some stones to black or white so that
  there will be no white stone immediately to the right of a black stone. Find
  the minimum number of stones that needs to be recolored.
samples: [{"input": "3\n    #.#", "output": "1\n    \n\nIt is enough to change the color of the first stone to white.\n\n* * *"}, {"input": "5\n    #.##.", "output": "2\n    \n\n* * *"}, {"input": "9\n    .........", "output": "0"}]