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

ans = 0
p = 0
q = 0
sai = 0
v = 0
w = 0
for i in range(n):
    if s[i] == "#" and sai == 0:
        p += 1
        v = 1
        sai = 1
    elif s[i] == "#" and v == 0:
        ans += min(p, q)
        p = 0
        q = 0
        w = 0
        p += 1
        v = 1
    elif s[i] == "#" and v == 1:
        p += 1
    elif s[i] == "." and w == 0 and sai == 1:
        v = 0
        q += 1
        w = 1
    elif s[i] == "." and w == 1:
        q += 1
ans += min(p, q)
print(ans)
