from itertools import accumulate


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

black = [0 for _ in range(N)]
white = [0 for _ in range(N)]

for i, s in enumerate(S):
    if s == '#':
        black[i] = 1
    else:
        white[i] = 1

# 累積和
black = [0] + black
black = list(accumulate(black))
white = [0] + white[::-1]
white = list(accumulate(white))[::-1]

ans = []
for i in range(N):
    ans.append(black[i] + white[i])

print(min(ans))
