#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

int main() {
	int N, A, B;
	cin >> N;
	priority_queue<pair<int, int>, vector<pair<int, int>>,  greater<pair<int, int>>> a;
	for (int i = 0; i < N; ++i) {
		cin >> A >> B;
		a.emplace(A, 1);
		a.emplace(1 + B, -1);
	}
	vector<pair<int, int>> b;
	b.emplace_back(a.top().first, a.top().second);
	a.pop();
	while (!a.empty()) {
		if (a.top().first == b.back().first) b.back().second += a.top().second;
		else b.emplace_back(a.top().first, a.top().second + b.back().second);
		a.pop();
	}
	cout << max_element(b.begin(), b.end(), [](pair<int, int>& a, pair<int, int>& b) { return a.second < b.second; })->second << endl;
}
