##### TPBC201C - Stones
n = int(input())
s = input()
if len(set(s)) == 1:
    print(0)
else:
    ans = n + 1
    blk = s.count("#")
    b = 0
    for i, j in enumerate(s, start=1):
        if j == "#":
            b += 1
        ans = min(ans, b + n - i - (blk - b))
    print(ans)
