def solve():
  n = int(input())
  s = input()

  ans = 10**15
  a = s.count(".")
  b = s.count("#")
  sharp = []
  dot = []
  tp = 1
  if a == n:
    print("0")
    exit()
  elif n == 1:
    print(b)
    exit()
  else:
    for i in range(n-1):

        if s[i] == s[i+1]:
           tp += 1
               
        if s[i] != s[i+1]:
            if s[i]==".":
                dot.append(tp)
                sharp.append(0)
            else:
                dot.append(0)
                sharp.append(tp)
            tp = 1
        if i == n-2:
           if s[i+1]==".":
                dot.append(tp)
                sharp.append(0)
           else:
                dot.append(0)
                sharp.append(tp)
           tp = 1
    
    e = len(sharp)
    ans = min(b-sharp[-1],a-dot[0])

    for i in range(e):
      if i%2 == 1 and i <= e-2:
       do = dot[i]+dot[i+1]
       sh = sharp[i]+sharp[i+1]
       sharpp = 0
       dotp = 0
       if not i in [0,e-1]:
        a += sh -do
        b += do- sh
        ans = min(ans,min(b-sharp[-1],a-dot[0]))
      
    #print(dot,sharp)     
    print(ans)
solve()