1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<algorithm>
5 using namespace std;
6 const int MAXN=10001;
7 struct node
8 {
9 int x;
10 int y;
11 }map[MAXN];
12 int now=0;
13 int comp(const node & a,const node & b)
14 {
15 if(a.x>b.x&&a.y>b.y)
16 return 1;
17 else
18 return 0;
19 }
20 int main()
21 {
22 int n;
23 scanf("%d",&n);
24 for(int i=1;i<=n;i++)
25 {
26 scanf("%d%d",&map[i].x,&map[i].y);
27 }
28 sort(map+1,map+n+1,comp);
29 int tot=1;
30 for(int i=1;i<=n;i++)
31 {
32 if(map[i].x<=map[i+1].x)
33 tot++;
34 }
35 printf("%d",tot);
36 return 0;
37 }