#include <bits/stdc++.h>
using namespace std;
int n, imos[100010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    int a, b;
    cin >> a >> b;
    imos[a]++, imos[b + 1]--;
  }
  for (int i = (0); i < (100000); ++i) imos[i + 1] += imos[i];
  int ans = 0;
  for (int i = (0); i < (n + 2); ++i) {
    ans = max(ans, imos[i]);
  }
  cout << ans - 1 << endl;
  return 0;
}
