n = int(input())
s = input()
if all([v == '.' for v in s]):
    print(0)
else:
    r = 0
    s = s[s.find('#'):]
    while (True):
        k = s.find('.#') + 1
        if k == 0:
            a = s.find('.')
            b = len(s) - a
            r += min(a, b)
            break
        else:
            t = s[:k]
            a = t.find('.')
            b = len(t) - a
            r += min(a, b)
            s = s[k:]
    print(r)
