#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
vector<P> vec;
int n,a,b;
signed main(){
	cin>>n;
	rep(i,n){
		cin>>a>>b;
		vec.push_back({a,1});
		vec.push_back({b+1,-1});
	}
	sort(vec.begin(),vec.end());
	int cnt=1;
	int ans=0;
	for(int i=1;i<vec.size();i++){
		if(vec[i].first!=vec[i-1].first){
			ans=max(ans,cnt);
		}
		cnt+=vec[i].second;
	}
	cout<<ans<<endl;
    return 0;
}


