1 #include<iostream>
2 #include<cstdio>
3 #include<algorithm>
4 using namespace std;
5 const int N=101;
6 struct node{
7 int q,h;
8 }s[N];
9 bool cmp(node a,node b)
10 {
11 return a.h<b.h;
12 }
13 int main()
14 {
15 int n;
16 cin>>n;
17 for(int i=1;i<=n;i++)
18 {
19 cin>>s[i].q>>s[i].h;
20 if(s[i].q>s[i].h)swap(s[i].q,s[i].h);
21 }
22 sort(s+1,s+n+1,cmp);
23 int ans=0;
24 for(int i=1;i<=n-1;i++)
25 {
26 if(s[i].h>s[i+1].q)
27 {
28 ans++;
29 s[i+1].h=s[i].h;
30 }
31 }
32 cout<<n-ans;
33 }