n = int(input())
s = input()
ans = 0
init = True
for i in range(n):
    if (not init) and s[i] == '#':
        ans -= 1
    if init and s[i] == '#':
        ans = n - i - 1
        init = False
cnt = 0
for c in s[::-1]:
    if c == '.':
        break
    cnt += 1
ans = min(ans, s.count('#') - cnt)
print(ans)