include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
typedef pair[HTML_REMOVED] P;
const int N=100010;
bool cmp(P a,P b)
{
if(a.first[HTML_REMOVED]>n;
for(int i=0;i[HTML_REMOVED]>w[i].first>>w[i].second;
}
sort(w,w+n,cmp);
vector[HTML_REMOVED] merged;
merged.push_back(w[0]);
for(int i=1;i<n;i++)
{
if((w[i].first<=merged.back().second))
merged.back().second=max(merged.back().second,w[i].second);
else
merged.push_back(w[i]);
}
cout<<merged.size()<<endl;
return 0;
}