data class XY(var x: Int, var y: Int) {
    constructor(xy: List<Int>): this(xy[0], xy[1])
}
fun main(args: Array<String>) {
    val N = nextInt()
    val R = Array(N) { XY(listOfInt()) }.sortedByDescending { it.y }
    val B = Array(N) { XY(listOfInt()) }.sortedBy { it.x }.toMutableList()
    var ans = 0
    for (r in R) {
        for (b in B) {
            if (r.x < b.x && r.y < b.y) {
                ans += 1
                B.remove(b)
                break
            }
        }
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt(d: Int = 0) = listOfString().map { it.toInt() + d }
fun listOfLong(d: Long = 0) = listOfString().map { it.toLong() + d }


