#include <iostream>
#include <map>
using namespace std;
int main(int argc, char *argv[]) {
int n;
cin >> n;
map<int, int> timeframes;
for (int i = 0; i < n; ++i) {
int start, end;
cin >> start >> end;
for (int j = start; j <= end; ++j) {
if (timeframes.find(j) == timeframes.end()) {
timeframes[j] = 0;
}
timeframes[j] += 1;
}
}
int max = INT_MIN;
int max_time = -1;
for (const auto rec : timeframes) {
if (max < rec.second) {
max = rec.second;
max_time = rec.first;
}
}
cout << timeframes[max_time] << endl;
return 0;
}