#include<stdio.h>
int sta[250005],top=0;
int main(){
int n,ans=0,x,y;
scanf("%d",&n);
while(n--){
scanf("%d%d",&x,&y);
while(top && sta[top-1]>y) top--;
if(top && y>sta[top-1]){
ans++;
sta[top++]=y;
}
if(top==0){
ans++;
sta[top++]=y;
}
}
printf("%d\n",ans);
}
沒有留言:
張貼留言