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

flg = 0
idx = 0
for i in S:
    if i == '#' and flg == 0:
        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
    ans = min(a, b)
else:
    ans = 0
key = [0]
S = S[idx:]
for i in range(1, len(S)):
    if S[i] == '#' and S[i-1] == '.':
        key.append(i)
if len(key) > 2:
    for i in range(len(key)-1):
        c = S[:key[i+1]].count('#') + S[key[i+1]:].count('.')
        ans = min(ans, c)

print(ans)
