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