#include <bits/stdc++.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  int a,b;
  vector<pair<int,int>> aaa(2*n);
  for(int i=0;i<n;i++){
    cin >> a >> b;
    aaa[2*i]={a,1};
    aaa[2*i+1]={b+1,-1};
  }
  sort(all(aaa));
  int ans=0;
  int total=0;
  for(int i=0;i<2*n-1;i++){
    total+=aaa[i].second;
    if(aaa[i].first!=aaa[i+1].first){
      ans=max(ans,total);
    }
  }
  total+=aaa[2*n-1].second;
  ans=max(ans,total);
  cout << ans << endl;
  return 0;
}

