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