from itertools import groupby
N = int(input())
S = input()
ans = 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:]
if stone:
  if stone[-1] == "#":
    stone = stone[:-1]
    num = num[:-1]
if stone:
  ans = min(sum(num[::2]), sum(num[1::2]))
print(ans)