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

w = [0 for _ in range(N)]
b = [0 for _ in range(N)]

mark = []
f = 0

for i in range(N):
    if S[i] == "#":
        f = 1
        b[i] += 1
    else:
        if f:
            mark.append(i-1)
            f = 0
        w[i] += 1

w_r = [0 for _ in range(N+1)]
b_r = [0 for _ in range(N+1)]

for i in range(N):
    w_r[i+1] += w[i] + w_r[i]
    b_r[i+1] += b[i] + b_r[i]

ans = 0
if mark:
    ans = float("inf")
# print(w_r)
# print(b_r)
# print(mark)
for i in mark:
    ans = min(ans, b_r[i]+w_r[-1]-w_r[i])

print(ans)
