#include <bits/stdc++.h>
int N, F[100010], L, M, i, t = 0, r = 0;
int main() {
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d%d", &L, &M);
    F[L]++;
    F[M + 1]--;
  }
  for (i = 1; i <= N; i++) {
    t += F[i];
    r = r > t ? r : t;
  }
  printf("%d\n", r - 1);
  return 0;
}
