n = int(input())
S = input()
left = []
right = []
cl = 0
cr = 0
for i in range(n):
  left = left + [cl]
  if S[i] == "#":
    cl += 1
  right = [cr] + right
  if S[n - 1 -i] == ".":
    cr += 1
min = S.count("#")
for i in range(n):
  if S[i] == "#":
    p = left[i] + right[i]
    if p < min:
      min = p
print(min)