import scala.io.StdIn

object Main extends App {
  case class Point(x: Int, y: Int)
  def readPoints(n: Int): List[Point] = (0 until n).foldLeft(List.empty[Point]){
    (acc, _)  =>
      val wkp = StdIn.readLine().trim.split(' ').map(_.toInt)
      Point(wkp(0), wkp(1)) :: acc
  }

  def comparePoint(red: Point, blue: Point): Boolean = red.x < blue.x && red.y < blue.y

  val pointCount = StdIn.readLine().trim.toInt
  val redPoints = readPoints(pointCount).sortBy(e => (e.x, e.y))
  val bluePoints = readPoints(pointCount).sortBy(e => (e.x, e.y))

  val r = bluePoints.foldLeft(0, Set.empty[Point], Set.empty[Point]){ (acc, e) =>
    var cnt = acc._1
    var checkRed = acc._2
    var checkBlue = acc._3

    val targetRed = redPoints.filterNot(p => checkRed.contains(p)).filter(p => comparePoint(p, e)).sortBy(p => -p.y)
    if(targetRed.nonEmpty && !checkBlue.contains(e)){
      (cnt + 1, checkRed + targetRed.head, checkBlue + e) 
    } else {
      (cnt, checkRed, checkBlue)
    }
  }
  println(r._1)
}