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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

  map<int, int> zip;
  map<int, int> unzip;
  map<int, int> tmp;
  vector<int> A(N), B(N);
  for ( int i = 0; i < N; i++ ) {
    int a, b;
    cin >> a >> b;
    A[i] = a;
    B[i] = b;    
    tmp[a] = tmp[b] = 1; 
  }  

  int cnt = 0;
  for ( auto i : tmp ) {
    zip[i.first] = cnt++;    
    unzip[cnt-1] = i.first;    
  }

  vector<int> cum(400000, 0);  
  for ( int i = 0; i < N; i++ ) {
    cum[zip[A[i]]]++;
    cum[zip[B[i]]+1]--;    
  }

  for ( int i = 0; i < 300000-1; i++ ) {
    cum[i+1] += cum[i];    
  }

  int ma = 0;
  for ( int i = 0; i < 300000-1; i++ ) {
    ma = max(cum[i], ma);    
  }

  cout << ma << endl;  
  
  return 0;
}

