program prime_numbers
    implicit none
    integer(8) i, j,n,m,Q,l,r,y,p1,q1
    integer, allocatable :: x(:,:),p(:,:)
    
    read (*,*)n ,m,q
    allocate(x(2,m))
    allocate(p(2,q))
    read(*,*)x
    read(*,*)p
    !transpose(x)
    !transpose(p)
    do i=1,q
        y=0
        !p1=p(i,1)
        !q1=p(i,2)
        do j=1,m
          if (p(1,i)<=x(1,j) .and. x(2,j)<=p(2,i))then
            y=y+1
          end if
        end do
        write(*,*)y
    end do
    deallocate(x)
    deallocate(p)
   
    stop
end program prime_numbers