include[HTML_REMOVED]
using namespace std;
const int N=1e5+10;
struct Range{
int l,r;
bool operator<(const Range &W) const{
return r [HTML_REMOVED]> n;
for(int i=0;i[HTML_REMOVED]> l>> r;
range[i]={l,r};
}
sort(range,range+n);
int res=0,ed=-2e9;
for(int i=0;i<n;i++){
if(range[i].l>ed){
res++;
ed=range[i].r;
}
}
cout<<res<<"\n";
return 0;
}