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

ans = N
left_black = [0]
right_white = [0]

for i in range(N):
    if S[i] == '#':
        left_black.append(left_black[-1] + 1)
    else:
        left_black.append(left_black[-1])
    if S[N - 1 - i] == '.':
        right_white.insert(0, right_white[0] + 1)
    else:
        right_white.insert(0, right_white[0])

for i in range(N + 1):
    ans = min(ans, left_black[i] + right_white[i])
print(ans)
