n = int(input())
s = list(input())
s += [0]
import collections as coll
t = coll.Counter(s)
b1,w1=t["#"],t["."]

b = 0
w = 0
p = 0
q = 10 ** 18
for i in range(n):
    if s[i] == "#":
        b += 1
    else:
        w += 1
    p = b + w1 - w
    if p < q:
        q = p

print(q)