from itertools import groupby
N = int(input())
S = input()
b = 0
w = 0
stone = ""
num = []
for k, v in groupby(S):
  stone += k
  num.append(len(list(v)))
if stone[0] == ".":
  stone = stone[1:]
  num = num[1:]
try:
  if stone[-1] == "#":
    stone = stone[:-1]
    num = num[:-1]
except:
  pass
if stone:
  for i, s in enumerate(stone):
    if s == "#":
      b += num[i]
    else:
      w += num[i]
print(min(b,w))