object Main extends App {
  import scala.io.StdIn._

  val n = readInt
  val (lower, upper) = Array.tabulate(n){_ ⇒
    val Array(a, b) = readLine.trim.split(' ').map(_.toLong)
    (a, b)
  }.let{a ⇒ (a.map(_._1).sorted, a.map(_._2).sorted)}

  println(
    lower.map(v ⇒
      upperBound(lower, v) - lowerBound(upper, v)
    ).max
  )

  def upperBound(array: Array[Long], target: Long): Int = {
    var left = 0
    var right = array.length
    while(left < right){
      val mid = (left + right) / 2
      if (array(mid) <= target){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
  def lowerBound(array: Array[Long], target: Long): Int = {
    var left = 0
    var right = array.length
    while(left < right){
      val mid = (left + right) / 2
      if (array(mid) < target){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}
