N = int(input())
S = input()

tmp = S[0]
count = 0

Blist = []
Wlist = []

for i in range(N):
    if S[i] == tmp:
        count += 1
    else:
        if tmp == '#':
            Blist.append(count)
        else:
            Wlist.append(count)
        count = 1
        tmp = S[i]

if S[-1] == '#':
    Blist.append(count)
else:
    Wlist.append(count)

if S[0] == '.':
    Wlist = Wlist[1:]

if S[-1] == '#':
    Blist = Blist[:-1]

counter = []

ruiB = [0]
ruiW = [sum(Wlist)]

for i in range(len(Blist)):
    ruiB.append(Blist[i] + ruiB[-1])
    ruiW.append(ruiW[-1] - Wlist[i])


if len(Wlist) == 0:
    print(0)
elif len(Wlist) == 1:
    print(min(Wlist[0], N-Wlist[0]))
else:
    for i in range(len(ruiB)):
        counter.append(ruiB[i] + ruiW[i])
        print(min(counter))
