#include<bits/stdc++.h> using namespace std; struct node{ int begin,end; }a[101]; bool cmp(node x,node y) { return x.end<y.end; } int n,nowend,ans; int main(){ cin>>n; for(int i=1;i<=n;i++) { cin>>a[i].begin>>a[i].end; } sort(a+1,a+1+n,cmp); nowend=a[1].end; for(int i=2;i<=n;i++) { if(a[i].begin>=nowend){ ans++; nowend=a[i].end; } } cout<<ans+1; } /************************************************************** Problem: 1372 User: wuzhehan Language: C++ Result: Accepted Time:8 ms Memory:2076 kb ****************************************************************/