#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const long double eps = 1e-9;
int main() {
  int n;
  cin >> n;
  vector<int> sum(100010, 0);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    sum[a]++;
    sum[b + 1]--;
  }
  for (int i = 1; i < 100010; i++) sum[i] += sum[i - 1];
  int ret = 1;
  for (int i = 0; i <= n + 1; i++) ret = max(ret, sum[i]);
  cout << ret - 1 << endl;
  return 0;
}
