(defparameter n (read))
(defparameter s (coerce (read-line) 'list))

(defun f (lst acc# acc)
  (declare (optimize (speed 3) (debug 0) (safety 0)))
  (cond ((or (endp lst)
             (endp (cdr lst)))
         acc)
        ((and (char= #\. (car lst))
              (char= #\# (cdr lst)))
         (f (cdr lst) acc# (cons acc# acc)))
        ((char= #\# (car lst))
         (f (cdr lst) (1+ acc#) acc))
        (t (f (cdr lst) acc# acc))))
(defun g (lst acc. acc)
  (declare (optimize (speed 3) (debug 0) (safety 0)))
  (cond ((or (endp lst)
             (endp (cdr lst)))
         acc)
        ((and (char= #\# (car lst))
              (char= #\. (cdr lst)))
         (g (cdr lst) acc. (cons acc. acc)))
        ((char= #\. (car lst))
         (g (cdr lst) (1+ acc.) acc))
        (t (g (cdr lst) acc. acc))))

(format t "~a" (reduce #'min (mapcar #'+
                                     (f s 0 '())
                                     (nreverse (g (reverse s) 0 '())))))
