#include <climits>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

struct Event {
  int x, add;
  bool operator < ( const Event &e ) const {
    if (x != e.x)
      return x < e.x;
    return add > e.add;
  }
};
const int N = 1e5;
int n, en;
Event e[2 * N];
int main() {
  scanf("%d", &n);
  forn(i, n) {
    int l, r;
    scanf("%d%d", &l, &r);
    e[en++] = {l, +1}; 
    e[en++] = {r, -1};
  }
  sort(e, e + en);
  int answer = 0, sum = 0;
  forn(i, en) 
    answer = max(answer, sum += e[i].add);
  printf("%d\n", answer);
}