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

W = [0]*N
B = [0]*N
white = 0
black = 0

for i in range(N):
    if S[i] == '.':
        white += 1
    if S[-i-1] == '#':
        black += 1

    W[i] = white
    B[-i-1] = black

ans = N - max(white, black)
for i in range(N-1):
    tmp = abs((i+1)-W[i]) + abs((N-i-1)+B[i+1])
    if tmp < ans:
        ans = tmp

print(ans)