import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
s = list(ns())
count = 0
lis = [0 for i in range(n)]
for i in range(len(s)):
    if s[i] == '.':
        count += 1
        lis[i] = count
    if s[i] == '#':
        count -= 1
        lis[i] = count
idx = lis.index(max(lis))
ans = s[:idx + 1].count('#') + s[idx + 1:].count('.')
print(ans)
