#include <iostream>
#include <algorithm>
using namespace std;

struct point
{
	int x,y;
}a[1005],b[1005];
int c[1005]; 

int cmp(point x,point y)
{
	if(x.x==y.x) return x.y<y.y;
	return x.x<y.x;
}

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].x>>a[i].y;
	}
	for(int i=1;i<=n;i++){
		cin>>b[i].x>>b[i].y;
	}
	sort(b,b+n,cmp);
	int ans=0;
	for(int i=1;i<=n;i++){
		int maxn=-1;
		int z=-1;
		for(int j=1;j<=n;j++){
			if(!c[j]&&a[j].x<b[i].x&&a[j].y<b[i].y&&a[j].y>maxn){
				maxn=a[j].y;
				z=j;
			}
		}
		if(maxn!=-1){
			c[z]=1;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
