N = int(input())
S = input()
i = 0
for i in range(N):
    if S[i] == '#':
        break

T = S[i:]
W = T.count('.')

cntB = 0
cntW = 0
excntB = 0
B = 0
j = 0
for j in range(N - i):
    if T[j] == '#':
        excntB = B
        cntB += 1
        cntW = 0
    else:
        B = cntB
        cntW += 1

print(min(B, W, excntB + cntW))