#include <bits/stdc++.h>
using namespace std;
int table[100002];
int main() {
  int N;
  int a, b;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    table[a] += 1;
    table[b + 1] += -1;
  }
  for (int i = 1; i < 100002; i++) {
    table[i] += table[i - 1];
  }
  int max = 0;
  for (int i = 0; i < 100002; i++) {
    if (max < table[i]) max = table[i];
  }
  cout << max - 1 << endl;
}
