N = int(input())
S = input()
b = 0
w = 0
ans = N
bcount = []
wcount = []
for i in range(N):
    if S[i] == ".":
        w += 1
        wcount.append(w)
        bcount.append(b)
    elif S[i] == "#":
        b += 1
        wcount.append(w)
        bcount.append(b)
for i in range(N+1):
    x = sum(wcount[:i])
    y = sum(bcount[i::-1])
    ans = min(ans, x+y)

print(ans)
