n = input()
N = int(n)

s = input()
S = list(s)

ans = 0
tmpW = 0
tmpB = 0
pre = -1

for s in S[::-1]:
    if s == '.' and pre == -1:
        tmpW += 1
        pre = 1
        # print("1")

    elif s == '.' and pre == 1:
        tmpW += 1
        # print("2")

    elif s == '.' and pre == 2:
        if tmpW < tmpB:
            ans += tmpW
        else:
            ans += tmpB
        pre == 1
        tmpW = 1
        tmpB = 0
        # print("3")

    if s == '#' and pre == 1:
        tmpB += 1
        pre = 2
        # print("4")

    elif s == '#' and pre == 2:
        tmpB += 1
        # print("5")

if tmpB == 0:
    pass
elif tmpW < tmpB:
    ans += tmpW
else:
    ans += tmpB
print(ans)