import Foundation
import Glibc
 
var str = readLine()!.components(separatedBy:" ")
var num = [Int]()
for i in str {
    num.append(Int(i)!)
}

var sch = [[Int]]()
for _ in 0..<num[0]{
    var n = [Int]()
    let s = readLine()!.components(separatedBy:" ")
    for j in s{
        n.append(Int(j)!)
    }
    sch.append(n)
}
var ans = 0;
for k in 0..<num[0]{
    let i = sch[k][0]-1;
    var c = 0;
    for j in 0..<num[0]{
        if(i>=sch[j][0]-1&&i<sch[j][1]){
            c=c+1;
        }
    }
    if(c>ans){
        ans=c;
    }
}
print(ans)