#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void input(vector<T>& v) {
  for (auto& x : v) cin >> x;
}
using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;
const int INF = 1 << 29;
int s[100004];
signed main() {
  int n;
  while (cin >> n && n) {
    memset(s, 0, sizeof(s));
    for (signed i = signed(0); i < signed(n); i++) {
      int a, b;
      cin >> a >> b;
      s[a]++;
      s[b + 1]--;
    }
    for (signed i = signed(0); i < signed(n + 2); i++) s[i + 1] += s[i];
    cout << *max_element(s, s + n + 2) - 1 << endl;
  }
}
