#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <iterator> #include <queue> using namespace std; int size = 0; const int MAXN = 10001; vector<vector<int>> line(MAXN,vector<int>(2));; class Main{ public: static void compute(int n){ sort(line.begin(),line.end(),[](const vector<int>& a,const vector<int>& b){ return a[0] < b[0]; }); int ans = 0; priority_queue<int,vector<int>,greater<int>> heap; for(int i = 0; i < n; i++){ while(!heap.empty() && heap.top() <= line[i][0]){ heap.pop(); } heap.push(line[i][1]); ans = max(ans,(int)heap.size()); } cout << ans << endl; } }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; while(cin >> n){ line.resize(n); for(int i = 0; i < n; i++){ cin >> line[i][0] >> line[i][1]; } Main::compute(n); } return 0; }