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