#include<bits/stdc++.h>
using namespace std;
struct hd{
	float ks;
	float js;	
}a[200];
bool cmp(hd x,hd y){
	if(x.js<y.js) return true;
	else return false;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].ks>>a[i].js;	
	}
	sort(a+1,a+1+n,cmp);
	int e=a[1].js,c=1;
	for(int i=1;i<=n;i++){
		if(a[i+1].ks>=e){
			c++;
			e=a[i+1].js;
		}
	
	}
	
	cout<<c;
	return 0;
}

/**************************************************************
	Problem: 1372
	User: wuzihang
	Language: C++
	Result: Accepted
	Time:20 ms
	Memory:2080 kb
****************************************************************/