object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._
    val n = readInt()
    val (red, blue) = (0 until 2*n).map(_ => Point(readLine().split(' ').map(_.toInt))).splitAt(n)

    def f(r: Seq[Point], b: Seq[Point], count: Int = 0): Int = {
      if (r.isEmpty) {
        count
      } else {
        b.filter(bp => r.head.x < bp.x && r.head.y < bp.y).sortBy(_.x).headOption match {
          case Some(taken) => f(r.tail, b.filter(bp => r.head.x < bp.x && bp != taken), count + 1)
          case None => f(r.tail, b.filter(bp => r.head.x < bp.x), count)
        }
      }
    }

    val redSorted = red.sortBy(_.x).toList
    println(f(redSorted, blue.filter(bp => redSorted.head.x < bp.x).sortBy(_.y).toList))
  }
}

case class Point(x: Int, y: Int)

object Point {
  def apply(a: Array[Int]) = new Point(a(0), a(1))
}
