#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n; scanf("%d", &n);
	std::vector<int> vec, a(n), b(n);
	for(int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
		
		vec.push_back(a[i]);
		vec.push_back(b[i]);
	}
	sort(begin(vec), end(vec)); vec.erase(unique(begin(vec), end(vec)), end(vec));
	
	std::vector<int> latte(vec.size() + 1, 0);
	for(int i = 0; i < n; i++) {
		int tap = lower_bound(begin(vec), end(vec), a[i]) - begin(vec);
		int ris = upper_bound(begin(vec), end(vec), b[i]) - begin(vec);
		
		latte[tap]++;
		latte[ris]--;
	}
	for(int i = 0; i < latte.size() - 1; i++) latte[i + 1] += latte[i];
	
	int ans = 0;
	for(auto v : latte) ans = std::max(ans, v);
	printf("%d\n", ans);
	return 0;
}

