#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define in insert
#define ump unordered_map
#define yes cout<<"Yes"<<"\n"
#define no cout<<"No"<<"\n"
const ll M = 998244353;
const ll INF = LLONG_MAX;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
const int N = 2e5+10;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n;cin>>n;
    vector<pair<pair<ll,ll>,ll >> arr;
    multiset<pair<ll,ll>> hotel;
    for(ll i=0;i<n;i++) {
        ll a,d;cin>>a>>d;arr.pb({{a,d}, i});
    }
    sort(arr.begin(), arr.end());
    ll r=1;
    vector<pair<ll,ll>> ans; ll ct=0;
    for(auto el: arr) {
        ll arrival = el.first.first;
        ll dep = el.first.second;
        if(hotel.empty()) {
            r=1;
            hotel.in({dep, r});
            ans.pb({el.second, r});
            r++;
        } else {
            auto fd=hotel.begin();
            if(fd->first<arrival) {
                ll room=fd->second;
                hotel.erase(fd);
                hotel.in({dep,room});
                ans.pb({el.second, room});
            } else {
                hotel.in({dep, r});
                ans.pb({el.second, r});
                r++;
            }
        }
        ct=max(ct,(ll)hotel.size());
    }
    cout<<ct<<endl;
}