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

tmp = S[0]
count = 0

Blist = []
Wlist = []

if tmp == '.':
    Blist.append(0)

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)

counter = []

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