case class pos(val x: Int, val y: Int)

object Main extends App {
	val n = scala.io.StdIn.readInt
	var red = new Array[pos](n)
	var blue = new Array[pos](n)

	for(i<-0 until n){
		val temp = scala.io.StdIn.readLine.split(" ").map(_.toInt)
		red(i) = pos(temp(0),temp(1))
	}

	for(i<-0 until n){
		val temp = scala.io.StdIn.readLine.split(" ").map(_.toInt)
		blue(i) = pos(temp(0),temp(1))
	}

	red = red.sortBy(_.x)
	blue = blue.sortBy(_.x)

	var ans = 0
	for(x <- blue){
		var idx = -1
		var max = -1

		for(i<-0 until n){
			if(red(i).x != -1){
				if(red(i).x <= x.x){
					if(red(i).y > max && red(i).y < x.y){
					idx = i
					max = red(i).y
				}
				}
			}
		}

		if(idx != -1){
			red(idx) = pos(-1,-1)
			ans += 1
		}
	}

	println(ans)

}