(let* ((n (read))
       (arr (read-line))
       (c 0)
       (d 0))
  (defun a-f (x)
    (format t "a-f~A~%" x)
    (cond ((= (1- n) x) x)
          ((char= (aref arr x) #\.) (a-f (1+ x)))
          (t (incf c) x)))
  (defun b-f (y)
    (format t "b-f~A~%" y)
    (cond ((= 0 y) y)
          ((char= (aref arr y) #\#) (b-f (1- y)))
          (t (incf d) y)))
  (defun f (a b)
    (let* ((p (a-f a))
           (q (b-f b)))
      (format t "~A:~A~%" p q)
      (cond ((= (1+ p) q) (princ (1- (+ c d))))
            ((< q p) (princ (+ c d)))
            (t (f (1+ p) (1- q))))))
  (f 0 (1- n)))