program main
	implicit none
	integer :: N, i
	integer, allocatable :: a(:), b(:), c(:), d(:), space(:, :)
	
	read(*, *) N
	allocate(a(1:N), b(1:N), c(1:N), d(1:N))
	do i = 1, N
		read(*, *) a(i), b(i)
	end do
	do i = 1, N
		read(*, *) c(i), d(i)
	end do
	
	allocate(space(0:max(maxval(a),maxval(c)), 0:max(maxval(b),maxval(d))))
	space = 0
	do i = 1, N
		space(0:a(i), 0:b(i)) = space(0:a(i), 0:b(i)) + 1
		space(0:c(i), 0:d(i)) = space(0:c(i), 0:d(i)) - 1
	end do
	write(*, *) N - maxval(space)
end program main