n = int(input())
s = input()
temp = []
temp2 = []
c = 0
pitem = ''
s2 = s + 'a'
for item in s2:
    if pitem == '' or item == pitem:
        c += 1
        pitem = item
    if item != pitem:
        temp.append(c)
        temp2.append(pitem)
        c = 1
        pitem = item
        continue

# print(temp)
# print(temp2)

ck = [0]
cs = [0]
c = 0
for i in range(len(temp2)):
    if temp2[i] == '#':
        c += temp[i]
    cs.append(c)
c = 0

for i in range(len(temp2))[::-1]:
    if temp2[i] == '.':
        c +=  temp[i]
    ck.insert(0, c)
ck.insert(0, 0)

cost = [cs[i] + ck[i+1] for i in range(len(temp2)+1)]

print(min(cost))
