N = int(input())
S = input()

bcounts = [0 for _ in range(len(S))]
wcounts = [0 for _ in range(len(S))]
cs = 0
for i in range(len(S)):
    if S[i] == '#':
        cs += 1
    bcounts[i] = cs
cs = 0
for i in reversed(range(len(S))):
    if S[i] == '.':
        cs += 1
    wcounts[i] = cs

INF = float('inf')
ans = INF
for i in range(len(S) - 1):
    if S[i] == '#' and S[i + 1] == '.':
        # 次の黒を超えたところの wcounts
        ni = i + 1
        while ni < len(S) and S[ni] == '.':
            ni += 1
        while ni < len(S) and S[ni] == '#':
            ni += 1
        if ni < len(S):
            wc = wcounts[ni]
        else:
            if wcounts[-1] == '.':
                wc = 1
            else:
                wc = 0
        ans = min(ans, bcounts[i] + wc)

print(0 if ans == INF else ans)
