n = int(input())
s = input()
b = 0
w = 0
bl = []
wl = []
for i in range(n):
    if s[i]==".":
        w += 1
        if b:
            bl.append(b)
            b = 0
    else:
        b += 1
        if w:
            wl.append(w)
            w = 0
if b:
    bl.append(b)
if w:
    wl.append(w)
b_sum = 0
w_sum = 0
if s[-1] == "#":
    b_sum = sum(bl[:-1])
else:
    b_sum = sum(bl)
if s[0] == ".":
    w_sum = sum(wl[1:])
else:
    w_sum = sum(wl)

print(min(b_sum,w_sum))