n = int(input())
dp = [0]*1000002#定义差量数组,比10^6大2
max_i = 0#最大右下标
for _ in range(n):#初始化差量数组
a, b = map(int,input().split())
dp[a] += 1
dp[b+1] -= 1
max_i = max(max_i,b)
a = [0]*(max_i+1)#浇水次数数组
cur = 0#当前浇水次数
for i in range(max_i+1):#初始化胶水次数数组
cur += dp[i]
a[i] += cur
print(max(a))



京公网安备 11010502036488号