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")
  else:
    for i in range(n-1):

        if s[i] == s[i+1]:
           tp += 1
               
        if s[i] != s[i+1] or i+1 ==n-1:
            if s[i]==".":
                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):
      do = dot[i]
      sh = sharp[i]
      a += do
      b += sh
      ans = min(ans,min(b-sharp[-1],a-dot[0]))
      
        
    print(ans)
solve()