object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val S = in.tail.head.toArray
  
  var i = 0
  var wc = 0
  var bc = 0
  var W = S.map(_ => 0)
  var B = S.map(_ => 0)
  while(i<S.size) {
    if(S(i)=='#') bc += 1 else wc += 1
    W(i) = wc
    B(i) = bc
    i += 1
  }
  //println(B.toSeq)
  //println(W.toSeq)
  
  var j = 0
  var ret = Int.MaxValue
  while(j < S.size - 1) {
    val lb = B(j) - 0//B(0)
    val rb = B(S.size-1) - B(j+1)
    val lw = W(j) - 0//W(0)
    val rw = W(S.size-1) - W(j+1)
    //println((lb, lw), (rb, rw))
    ////val tmp = Math.min(lb, lw) + Math.min(rb, rw)
    ////val tmp = Math.min(lb + rw, rb + lw)    
    val tmp = lb + rw    
    //println(ret, tmp)
    ret = Math.min(ret, tmp)
    j += 1
  }
  println(ret)
}
