N = int(input())
S = [1 if c == '#' else 0 for c in input()]
b_idx = len(S) - 1
for i in range(len(S)):
    if S[i] == 1:
        b_idx = i
        break

w_idx = 0
for i in range(len(S)):
    if S[-(i + 1)] == 0:
        w_idx = len(S) - (i + 1)
        break
w_idx += 1

res = sum(S[b_idx:w_idx])
length = max(0, (w_idx - b_idx))
print(min(res, length - res))
