import bisect
n = int(input())
s = list(input())
b = [0]*(n+1)
c = [0]*(n+1)
a = []
c[0] = s.count(".")
for i in range(n):
    if s[i] == "#":
        b[i+1] = b[i] + 1
        c[i+1] = c[i]
    else:
        c[i+1] = c[i] - 1
        b[i+1] = b[i]
    a.append(b[i+1] + c[i+1])
if "." not in s:
    a.append(0)
elif "#" not in s:
    a.append(0)
print(min(a))