n = int(input());s = input()
sharp = []
for i, c in enumerate(s):
  if c == "#": sharp.append(i)
sharp.append(n)
ans1 = 0
for i in range(len(sharp)-1): ans1 += sharp[i+1] - sharp[i] - 1

dot = []
for i, c in enumerate(reversed(s)):
    if c == ".": dot.append(i)
dot.append(n)
ans2 = 0
for i in range(len(dot)-1): ans2 += dot[i+1] - dot[i] - 1

print(min(ans1, ans2))