program caddi2018b
  implicit none
  integer n, h, w, i
  integer, dimension(:), allocatable :: a, b
  logical, dimension(:), allocatable :: m

  read *, n, h, w
  allocate(a(n), b(n), m(n))
  m = .false.
  do i = 1,n
     read *, a(i), b(i)
  end do
  forall(i = 1:n, a(i).ge.h.and.b(i).ge.w) m(i) = .true.
  print '(i0)', count(m)
end program caddi2018b
