from numpy import*
from itertools import*
n=int(input())
s=input()
t=[len(list(v)) for k,v in groupby(s)]
#print(s)


if s[0]=="#":
    n=list(accumulate(t[i]for i in range(0,len(t),2)))
    m=list(accumulate(t[i]for i in range(1,len(t),2)))[::-1]
    if len(n)!=len(m):
        print(min(array([0]+n)+array(m+[0]*2)))
    else:
        print(min(array([0]+n)+array(m+[0])))
else:
    n=list(accumulate(t[i]for i in range(1,len(t),2)))
    m=list(accumulate(t[i]for i in range(0,len(t),2)))[::-1]
    if len(n)!=len(m):
        print(min(array([0]*2+n)+array(m+[0])))
    else:
        print(min(array([0]+n)+array(m+[0])))