N = int(input())
S = input()
ans = N
pos = 0
# S = [S[n] == '#' for n in range(N)]
sumB = [0] * N
tmp = 0
for i in range(N):
    if S[i] == '#':
        tmp += 1
    sumB[i] = tmp
cntB = 0
for i in range(N):
    ans = min(sumB[i] + (N - i - 1) - (sumB[N-1] - sumB[i]), ans)

    # print(sumB[i] , (N - i - 1) - (sumB[N-1] - sumB[i]), ans)
print(ans)
