program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,ans=0
    integer(int32), allocatable:: a(:), b(:), c(:),d(:)
    logical,allocatable:: used(:)

    read*, n
    allocate(a(n),b(n),c(n),d(n))
    allocate(used(n),source=.false.)

    do i=1,n
        read*, a(i), b(i)
    end do
    do i=1,n
        read*, c(i),d(i)
    end do

    call double_sort(c,d,1,n)
    c(:) = c(n:1:-1)
    d(:) = d(n:1:-1)
    call double_sort(b,a,1,n)


    do i=1,n
        do j=1,n
            if (c(i) > a(j) .and. d(i) > b(j)) then
                if (.not.(used(j))) then
                    used(j) = .true.
                    ans=ans+1
                    exit
                end if
            end if
        end do
    end do
    print'(i0)', ans

    contains
    recursive subroutine double_sort(ar1, ar2, fst, lst)
        integer(4),intent(inout):: ar1(:),ar2(:)
        integer(4),intent(in):: fst,lst
        integer(4):: mdl

        if (lst - fst < 2) then
            if (ar1(fst) < ar1(lst)) then
                call swap(ar1(fst), ar1(lst))
                call swap(ar2(fst), ar2(lst))
            end if
            return
        end if

        mdl = (fst+lst)/2

        call double_sort(ar1,ar2,fst,mdl)
        call double_sort(ar1,ar2,mdl+1,lst)
        call double_merge_(ar1,ar2,fst,mdl,lst)
    end subroutine


    subroutine double_merge_(ar1,ar2,fst,mdl,lst)
        integer(4),intent(inout):: ar1(:),ar2(:)
        integer(4),intent(in):: fst,mdl,lst
        integer(4),allocatable:: t1(:),t2(:)
        integer(4):: li,ri,ti

        allocate(t1(lst-fst+1), t2(lst-fst+1))

        li=fst
        ri=mdl+1
        ti=1

        do while(li <= mdl .and. ri <= lst)
            if (ar1(li) >= ar1(ri)) then
                t1(ti) = ar1(li) 
                t2(ti) = ar2(li)
                li=li+1
            else
                t1(ti) = ar1(ri)
                t2(ti) = ar2(ri)
                ri=ri+1
            end if
            ti=ti+1
        end do

        if (li <= mdl) then
            t1(ti:) = ar1(li:mdl)
            t2(ti:) = ar2(li:mdl)
        else
            t1(ti:) = ar1(ri:lst)
            t2(ti:) = ar2(ri:lst)
        end if

        ar1(fst:lst) = t1(:)
        ar2(fst:lst) = t2(:)

        deallocate(t1,t2)
    end subroutine

    
    subroutine swap(x,y)
        integer(4),intent(inout):: x,y
        integer(4):: tmp
        tmp = x
        x = y
        y = tmp
    end subroutine

    

end program main