import sys

n = int(sys.stdin.readline())
s = sys.stdin.readline()

bcnt = 0
ans = 0
for t in s:
    if t == '#':
        bcnt += 1
    else:
        if bcnt > 0:
            ans += 1
            bcnt -= 1

print(ans)
