
from itertools import groupby
N = int(input())
S = input()
b = 0
w = 0
x = ""
for k, v in groupby(S):
  if not x:
    if k == ".":
      continue
  v = len(list(v))
  if k == "#":
    b += v
  else:
    w += v
  x += k
if x:
  if x[-1] == "#":
    b -= v
print(min(b,w))