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: List[Point], b: List[Point], count: Int = 0): Int = {
      r match {
        case rp :: rpTail =>
          b.filter(bp => rp.x < bp.x && rp.y < bp.y).sortBy(_.x).reverse.headOption match {
            case Some(bp) => f(rpTail, b.filterNot(_ == bp), count + 1)
            case None => f(rpTail, b, count)
          }
        case Nil => count
      }
    }

    println(f(red.sortBy(_.x).toList.reverse, blue.sortBy(_.y).toList))
  }
}

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

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