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

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

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

  st = N
  for i in range(N):
    if S[i] != '.':
      st = i
      break
  ed = 0
  for i in range(N):
    if S[N - 1 - i] != '#':
      ed = N - i
      break

  if ed <= st:
    print(0)
    return

  count = 0
  current = '#'
  whites = []
  blacks = []
  for i in range(st, ed):
    if S[i] != current:
      if current == '#':
        blacks.append(count)
      else:
        whites.append(count)
      current = S[i]
      count = 0
    count += 1
  if count > 0:
    whites.append(count)

  accWhites = [0 for _ in range(len(whites) + 1)]
  for i in range(len(whites)):
    accWhites[i+1] = accWhites[i] + whites[i]
  accBlacks = [0 for _ in range(len(blacks) + 1)]
  for i in range(len(blacks)):
    accBlacks[i+1] = accBlacks[i] + blacks[i]

  ans = N
  for i in range(len(blacks)):
    w = accWhites[len(whites)] - accWhites[i]
    b = accBlacks[i] - accBlacks[0]
    ans = min(ans, w + b)
  print(ans)

if __name__ == "__main__":
  main()
