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

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

if S[0] == '.':
    tmp[0] = 1

for i in range(N):
    if S[i] == '.':
        tmp[i+1] = tmp[i] + 1
    else:
        tmp[i+1] = tmp[i]
  
res1 = 10 ** 9
for i in range(N):
    res1 = min((i + 1) - tmp[i] + tmp[N] - tmp[i], res1)
        

b = 0
w = 0
for i in range(N):
    if S[i] == '#':
        b += 1
    else:
        w += 1

res3 = N - max(b, w)

print(min(res1, res3))