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