rt
https://www.luogu.com.cn/record/75054378
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
#define ll long long
#define us unsigned
int n;
struct wood
{
int l, w;
} a[N];
bool cmp(wood a, wood b)
{
if (a.w != b.w) return a.w > b.w;
else return a.l > b.l;
}
int main()
{
cin >> n;
for (int i=1; i<=n; i++)
{
cin >> a[i].l >> a[i].w;
}
sort(a+1, a+n+1, cmp);
ll ans = 0;
for (int i=1; i<=n; i++)
{
if (a[i].l > a[i-1].l || a[i].w > a[i-1].w) ans ++;
}
cout << ans << endl;
return 0;
}