#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)


signed main(){
  int n;
  cin>>n;
  vector<pair<int,int> > v;
  lp(i,n){
    int x,y;
    cin>>x>>y;
    v.push_back({x,1});
    v.push_back({y+1,-1});
  }
  int ans=0;
  int now=0;
  sort(v.begin(),v.end());
  int bef=-1;
  lp(i,v.size()){
    if(bef!=v[i].first){
      ans=max(now,ans);
    }
    bef=v[i].first;
    now+=v[i].second;
  }
  cout<<ans<<endl;
  return 0;
}


