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

ans = N
for i in range(N + 1):
    left_num = S[:i].count('#')
    right_num = S[i:].count('.')

    if right_num == N - i:
        right_num = 0
    ans = min(ans, (left_num + right_num))
    if right_num in [0, N - i] or left_num > right_num:
        break
print(ans)