(let* ((n (read))
       (arr (read-line))
       (c 0)
       (d 0))
  (defun a-f (x)
    (cond ((= (1- n) x) x)
          ((char= (aref arr x) #\.) (a-f (1+ x)))
          (t x)))
  (defun b-f (y)
    (cond ((= 0 y) y)
          ((char= (aref arr y) #\#) (b-f (1- y)))
          (t y)))
  (defun f (a b)
    (let* ((p (a-f (1+ a)))
           (q (b-f (1- b))))
      (cond ((= p q) (+ c d))
            ((= (1+ p) q) (+ c d 1))
            ((< q p) (+ c d))
            (t (incf c) (incf d) (f (1+ p) (1- q))))))
  (princ (min (f -1 n) (count #\# arr :test #'char=) (count #\. arr :test #'char=))))