N = int(input())
S = [i for i in input()]

flg = 0
idx = 0
for i in S:
    if i == '#':
        flg = 1
        break
    idx += 1

if flg == 1:
    a = S[idx+1:].count('.')
    b = S[idx:].count('#')
    if S[-1] == '#':
        for ct in range(1, N+1):
            if S[-ct] == '.':
                break
        b -= ct-1
    ct = 1
    for i in S[idx+1:]:
        if i == '.':
            break
        ct += 1
    c = ct
    for i in S[idx+ct+1:]:
        if i == "#":
            break
        ct += 1
    c += S[idx+ct+1:].count('.')
    ans = min(a, b)
    ans = min(ans, c)
else:
    ans = 0

print(ans)
