n = int(input())
dic = {}
c = 0
for i in range(n):
    a, d = map(int,input().split())
    dic[a] = dic.get(a,0) + 1
    dic[d+1] = dic.get(d+1,0) - 1
    if d > c:
        c = d
s = 0
m = 0
for i in sorted(dic.keys()):
    if i > c:
        break
    s += dic[i]
    if s > m:
        m = s
print(m)