fun main(args: Array<String>) {
    class Coordinate(var x: Int, var y: Int)
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val red = arrayOfNulls<Coordinate>(n)
    val blue = arrayOfNulls<Coordinate>(n)
    for (i in 0 until n) {
        red[i] = Coordinate(sc.nextInt(), sc.nextInt())
    }
    for (i in 0 until n) {
        blue[i] = Coordinate(sc.nextInt(), sc.nextInt())
    }
    java.util.Arrays.sort(red, { pt1, pt2 -> pt2!!.y - pt1!!.y })
    java.util.Arrays.sort(blue, { pt1, pt2 -> pt1!!.x - pt2!!.x })

    var count = 0
    for (i in 0 until n) {
        for (j in 0 until n) {
            if (red[j] == null) continue
            if (red[j]!!.x < blue[i]!!.x && red[j]!!.y < blue[i]!!.y) {
                red[j] = null
                count++
                break
            }
        }
    }
    println(count)
}