program main
  implicit none
  integer(8) N, i ,score, saishozantei!暫定トップ
  integer(8) lefts !左側の#
  integer(8) rightd !右側の.
  character(2*(10**5)) S
  read(*, *) N
  read(*, *) S
  lefts = 0
  rightd = 0
  !#の数
  do i = 1,N
    if (S(i:i) == '.') then
      rightd = rightd + 1
    end if
  end do
  saishozaitei = rightd
  do i = 1,N
    if (S(i:i) == '#') then
      lefts = lefts + 1
    else
      rightd = rightd - 1
    end if
    score = lefts + rightd
    saishozaitei = min(saishozantei,score)
  end do
  ans = saishozantei
  write(*,'(i0)') ans
end program main
