from itertools import accumulate
N = int(input())
S = input()
ind1 = 0
for i, x in enumerate(S):
    if x == '#':
        ind1 = i
        break
num = 0
for i, x in enumerate(S[::-1]):
    if x == '.':
        num = i
        break
ind2 = N - num
s = S[ind1:ind2]
if s[0] == '.' or s[-1] == '#' or len(s) == 0:
    print(0)
else:
    a = s.split('.')
    b = s.split('#')
    aa = []
    bb = []
    for x, y in zip(a, b):
        if len(x) != 0:
            aa.append(len(x))
        if len(y) != 0:
            bb.append(len(y))
    d = [0] + list(accumulate(aa))
    e = [0] + list(accumulate(bb))
    p = d[-1]
    ls = []
    for i in range(min(len(d), len(e))):
        ls.append(e[i]+p-d[i])
    print(min(ls))