#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <string>
using namespace std;
const int maxn=1e4+5;

struct node
{
	int x;
	int y;
	bool vis;
}red[maxn],blue[maxn];

bool cmp(node n1,node n2)
{
    return n1.x < n2.x;
}

int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>red[i].x>>red[i].y;
		red[i].vis=0;
	}
		
	for(int i=0;i<n;i++)
	{
		cin>>blue[i].y>>blue[i].x;
		blue[i].vis=0;
	}
	sort(red,red+n,cmp);
	sort(blue,blue+n,cmp);
	int i=0,j=0,ans=0;
	
	for(i=n-1;i>=0;i--)
	{
		for(j=0;j<n;j++)
		{
			if(blue[j].vis) continue;
			if(blue[j].x>red[i].y&&blue[j].y>red[i].x)
			{
			
				blue[j].vis=1;
				ans++;
				break;
			}
		}
	}
	cout<<ans<<endl;
}