N = int(input())
S = input().strip()

ans = S.count("#.")
if ans == 0:
    print(0)
    exit()

prev = "."
c = [0]
ci = 0
for s in S:
    if s == "#":
        if prev == "#":
            c[ci] += 1
        else:
            ci += 1
            c.append(0)
            c[ci] += 1
        prev = "#"
    else:
        if prev == ".":
            c[ci] += 1
        else:
            ci += 1
            c.append(0)
            c[ci] += 1
        prev = "."

ans = 0
for i in range(1, len(c) - 1, 2):
    ans += min(c[i], c[i + 1])

print(ans)


