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