SIRO = '.'
KURO = '#'
N = int(input())
S = input()
sLst = [0] * N
kLst = [0] * N
sCnt = 0
kCnt = 0
for i in range(N):
    if S[i] == KURO:
        kCnt += 1
    kLst[i] = kCnt
for i in range(N - 1, 0, -1):
    if S[i] == SIRO:
        sCnt += 1
    sLst[-i - 1] = sCnt

ans = kLst[0] + sLst[0]
for i in range(1, N):
    ans = min(ans, kLst[i] + sLst[i])

print(ans)