import kotlin.comparisons.*

data class Point(val x: Int, val y: Int)

fun readPoint(): Point {
    val (x, y) = readLine()!!.split(' ').map(String::toInt)
    return Point(x, y)
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val red = Array(n) { readPoint() }
        .sortedWith(compareByDescending(Point::y).thenBy(Point::x))
        .toMutableList()
    val pairs = Array(n) { readPoint() }
        .sortedWith(compareBy(Point::x).thenByDescending(Point::y))
        .count { b ->
            val i = red.indexOfFirst { it.x < b.x && it.y < b.y }
            if (i != -1) {
                red.removeAt(i)
                true
            } else {
                false
            }
        }
    println(pairs)
}
