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

first_flag = False
second_flag = False
tmp_w = 0
tmp_b = 0
k = 0

for i, c in enumerate(s):
    if c == "#":
        if second_flag:
            if tmp_b > tmp_w:
                k += tmp_w
            else:
                k += tmp_b
            tmp_b = 0
            tmp_w = 0
            second_flag = False
        tmp_b += 1
        first_flag = True
    else:
        if first_flag:
            tmp_w += 1
            second_flag = True

    if i == len(s) - 1:
        if second_flag:
            if tmp_b > tmp_w:
                k += tmp_w
            else:
                k += tmp_b

print(k)
