n = int(input())
s = list(input())
ans = 0
b = 0
curw = 0
curb = 0
if n == 1:
    print(0)
    exit()
for i in range(n-1,-1,-1):
    if s[i] != "." and b == 0:
        continue
    if s[i] =="." and (b == 0 or b == 1):
        curw += 1
        b = 1
    if s[i] !="." and b == 1:
        curb += 1
        b = 2
    if s[i] == "." and b ==2:
        ans += min(curb,curw)
        b = 1
        curw += 1
if s[0] != "." and s[1] == ".":
    ans += 1
print(ans)