#include <iostream>
using namespace std;

int table[100001][100001];

int main(){
  int N;
  int a, b;

  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a >> b;
    table[i][a-1] = 1;
    table[i][b] = -1;
  }
  for(int i = 0; i < N; i++){
    for(int j = 1; j < N; j++){
      table[i][j-1] += table[i][j];
    }
  }

  for(int i = 1; i < 100001; i++){
    for(int j = 0; j < N; j++){
      table[i][j] += table[i-1][j];
    }
  }
  int max = 0;
  for(int i = 0; i < 100001; i++){
    if(max < table[100000][i]) max = table[100000][i];
  }
  cout << max << endl;
}