n = int(input())
s = input()
n=len(s)
x = 0
for i in range(n):
    y1=0
    for j in reversed(range(i)):
        if s[j] == "#":
            y1 += 1
        else:
            break
    y2=0
    for k in range(i, n):
        if s[k] == ".":
            y2 += 1
        else:
            break

    x += min(y1, y2)
print(str(x))
