n = int(input())
s = input()

accum_black = [0] * n
accum_white = [0] * n

if s[0] == '#':
    accum_black[0] = 1
else:
    accum_white[0] = 1

for i in range(1, n):
    if s[i] == '#':
        accum_black[i] = accum_black[i-1] + 1
        accum_white[i] = accum_white[i-1]
    elif s[i] == '.':
        accum_black[i] = accum_black[i-1]
        accum_white[i] = accum_white[i-1] + 1

# すべて白or黒の場合に備えて，[0]を追加する
accum_black = [0] + accum_black
accum_white = accum_white[::-1] + [0]

ans = []
for i in range(n+1):
    ans += [accum_black[i] + accum_white[i]]

print(min(ans))