program main
  implicit none
  integer :: i, n, lb, rw, res
  integer, allocatable :: nb(:)
  logical :: flag = .false.
  character(200000) :: s

  read *, n
  read *, s
  allocate (nb(n))
  nb = 0
  res = n

  do i = 1, n
    if (i >= 2) nb(i) = nb(i-1)
    if (s(i:i) == '#') nb(i) = nb(i) + 1 
  end do

  do i = 1, n-1
    if (s(i:i+1) == '.#') then
      lb = nb(i)
      rw = n-i-1 - (nb(n)-nb(i+1))
      res = min(res, rw+lb) 
    end if
  end do
  if (res==n) res = 0

  print '(i0)', res

end program
