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

if '.' not in S:
    print(0)
    exit()
elif '#' not in S:
    print(0)
    exit()

black_sum = 0
white_sum = 0
for i in range(N):
    if S[i] == '#':
        black_sum += 1
    else:
        white_sum += 1

left_black = 0
right_white = white_sum
min_sum = 10 ** 9
for i in range(N - 1):
    if S[i] == '#':
        left_black += 1
    else:
        right_white -= 1

    min_sum = min(min_sum, left_black + right_white)
print(min_sum)
