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

for i, c in enumerate(s):
    if c == "#":
        s = s[i:]
        break

if s.count("#") == 0 or s.count(".") == 0:
    print(0)
    exit()

tmp_b = 0
tmp_w = 0
k = 0
flag = False

for i, c in enumerate(s):
    if c == "#":
        if flag:
            if tmp_b > tmp_w:
                k += tmp_w
            else:
                k += tmp_b

            tmp_b = 0
            tmp_w = 0
            flag = False

        tmp_b += 1
    else:
        tmp_w += 1
        flag = True

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

print(k)
