n = int(input())
s = input()
left_w = n
for i in range(n):
    if s[i] == "#":
         left_w = i
         break
ans_w = 0
for i in range(n):
    if s[i] == ".":
        ans_w += 1

s = s[::-1]
right_b = n
for i in range(n):
    if s[i] == ".":
         right_b = i
         break
ans_b = 0
for i in range(n):
    if s[i] == "#":
        ans_b += 1

print(min(ans_w-left_w, ans_b-right_b))