#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define lP pair<ll,ll>
#define iP pair<int,int>

typedef long long ll;
using namespace std;
const int mod = 1e9 + 7;


int N, A[100000], B[100000], MAX;
map<int, int>mp;

int main(){
	cin >> N;
	for (int i = 0; i != N; ++i) {
		cin >> A[i] >> B[i];
		++mp[A[i]];
		--mp[B[i] + 1];
	}
	auto it = mp.begin(), it2 = mp.begin();
	++it;
	MAX = mp.begin()->second;
	for (it; it != mp.end(); ++it) {
		it->second += it2->second;
		++it2;
		MAX = max(MAX, it->second);
	}
	cout << MAX << endl;
	return 0;
}
