n=int(input())
s=input()
ans = 0
kuro = 0
if n==1:
    ans=0
if n ==2:
    if s=="#.":
        ans=1
else: 
    for i in s[1:-1]:
        if i=="#":
            kuro+=1
    siro=n-2-kuro
    if kuro>siro:
        ans+=siro
        if s[-1]==".":
            ans+=1
    elif kuro<siro:
        ans+=kuro
        if s[0]=="#":
            ans+=1
    else:
        ans+=kuro
        if s[0]=="#" or s[-1]==".":
            ans+=1
print(ans)
