n = int(input())
s = input()
ans = 0
a = 0
b = 0
for i in range(len(s)):
    if s[i] == '#':
        if i != 0:
            ans += min(a,b)
            a = 0
            b = 0
        a += 1
    if s[i] == '.':
        b += 1
        if i == len(s) -1:
            ans += min(a,b)
print(ans)