#include #include using namespace std; const int MaxN = 1e6+5; int n,nowT,ans; struct _time{ int start,end; }t[MaxN]; int main(){ cin>>n; for (int i=1; i<=n; i++) { cin>>t[i].start>>t[i].end; } sort(t+1,t+n+1,[](_time a,_time b){return a.end=nowT) { ans++; nowT=t[i].end; } } cout<