N=input()
S=raw_input()
u=len(S)
l=0
def check(s):
  a=0
  for i in range(s):
    if S[i]=="#":
        a+=1
  for i in range(s,len(S)):
    if S[i]==".":
      a+=1
  return(a)

w=2*10**5
while True:
    m1=(u-l)/3+l
    m2=(u-l)*2/3+l
    cm1=check(m1)
    cm2=check(m2)
    if cm1 < cm2:
        u=m2
    else:
        l=m1

    if u-l <= 6:
        for i in range(min(7, u-l)):
            w=min(w,check(l+i))
        break

print(w)