n = int(input())
s = input()
sr = s[::-1]
count_w = 0
count_b = 0
first_b = n
first_w = n
last_b = n
last_w = 0

for i in range(n):
    if s[i] == "#":
        first_w = i
        first_b = i+1
        break
for i in range(n):
    if sr[i] == ".":
        last_b = i
        break
if first_w+last_b == n:
    print(0)
    exit()

for i in range(n):
    if s[i] == "#":
        count_b += 1
    elif  s[i] == ".":
        count_w += 1

for i in range(first_b, n):
    if s[i] == ".":
        last_w += 1
print(min(count_b, count_w, last_w))
