n = int(input())
s = list(input())
c = [[0 for j in range(2)] for i in range(n+1)]
for i in range(n):
    if s[i] == ".":
        c[i+1][0] += c[i][0] + 1
        c[i+1][1] += c[i][1]
    else:
        c[i+1][0] += c[i][0]
        c[i+1][1] += c[i][1] + 1
ans = 0
for i in range(n-1):
    if c[-1-i][0] >= c[-1-i][1]:
            ans += c[-1-i][1]
            break
    if s[-1-i] == "." and s[-2-i] == "#":
        s[-2-i] == "."
        ans += 1
print(ans)