# coding: utf-8
# Your code here!

n = int(input())
s = input()

b = sum([1 for i in s if i=="#"])
b2 = b
w = len(s)-b
w2 = w

ans1 = 0
ans2 = 0

f = False

for i in s:
    if i == "#":
        b-=1
        if b<w and not f:
            ans1+=1
        else:
            f = True
    else:
        if f:
            ans1+=1
        w-=1

f = False

for i in reversed(s):
    if i == ".":
        w2-=1
        if w2<b2 and not f:
            ans2+=1
        else:
            f = True
    else:
        if f:
            ans2+=1
        b2-=1
        
print(min(ans1,ans2))
