object Main extends App{
  val s=new java.util.Scanner(System.in)
  val n=s.nextInt()
  def f=Iterator.continually{(s.nextInt,s.nextInt)}
  val (xs,ys)=f.take(n*2).toVector.splitAt(n)
  val l=Array.ofDim[(Int,(Int, Int),(Int,Int))](n,n)
  for(i<-0 until n;j<-0 until n){
    val (a,b) = xs(i)
    val (c,d) = ys(j)
    if(a<c&&b<d)l(i)(j)=(c-a+d-b,(a,b),(c,d))
  }
  val p=Array.ofDim[Int](101,101)
  l.flatten.filter(_!=null).sortBy(_._1).foreach{case (_,(a,b),(c,d))=>
    if(p(a)(b)==0&&p(c)(d)==0) {
      p(a)(b)=1
      p(c)(d)=1
    }
  }
  println(p.map(_.sum).sum/2)
}