/********************************************

	Title		arc092.cpp
	Author 		TomatoLoveCoconut
	Time		2018-3-18
	History		Created 2018-3-18
	
	Version		1.0.0
	
	Tags:		二分图


	while(true) RP++;
	
		 QAQ

*********************************************/


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define base 311
#define mod 19260817
#define maxlongint 2147483647
#define maxint 32767
#define pi (double)acos(-1.0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
//SGT
#define MID (l+r)>>1
#define lson o<<1
#define rson o<<1|1
//clear the array
#define cla(a) memset(a,0,sizeof(a))
#define clb(a) memset(a,INF,sizeof(a));
#define clc(a) memset(a,-1,sizeof(a));
#define maxn 500


using namespace std;


//complex
struct Complex{
    double x,y;
    Complex(double xx=0,double yy=0){x=xx,y=yy;}
};
inline Complex operator + (Complex a,Complex b){return Complex(a.x+b.x,a.y+b.y);}
inline Complex operator - (Complex a,Complex b){return Complex(a.x-b.x,a.y-b.y);}
inline Complex operator * (Complex a,Complex b){return Complex(a.x*b.x-a.y*b.y,a.y*b.x+b.y*a.x);}
//BIT
inline int lowbit(int x){return x&(-x);}





struct Dinic{
    int vis[maxn],cur[maxn],head[maxn],d[maxn],b_cnt;
    struct Edge{
        int next,to,cap,flow,from;
    }edges[20005];
    int n,m,s,t;
    inline void init(int n,int m,int s,int t)
    {
        this->n=n;this->m=m;this->s=s;this->t=t;
    }
    Dinic()
    {
        b_cnt=-1;memset(head,-1,sizeof(head));
    }
    inline void addedge(int u,int v,int cap)
    {
        edges[++b_cnt].next=head[u];
        edges[b_cnt].to=v;
        edges[b_cnt].from=u;
        edges[b_cnt].cap=cap;
        edges[b_cnt].flow=0;
        head[u]=b_cnt;
        edges[++b_cnt].next=head[v];
        edges[b_cnt].to=u;
        edges[b_cnt].from=v;
        edges[b_cnt].cap=0;
        edges[b_cnt].flow=0;
        head[v]=b_cnt;
    }
    inline bool bfs()
    {
        memset(vis,0,sizeof(vis));
        memset(d,INF,sizeof(d));
        d[s]=1,vis[s]=1;
        queue<int> Q;
        Q.push(s);
        while (!Q.empty())
        {
            int u=Q.front();Q.pop();
            for (int i=head[u];i!=-1;i=edges[i].next)
            {
                Edge &e=edges[i];
                int v=edges[i].to;
                if (e.cap>e.flow && !vis[v])
                {
                    Q.push(v);
                    d[v]=d[u]+1;
                    vis[v]=1;
                }
            
            }
        }
        return vis[t];
    }
    inline int dfs(int u,int a)
    {
        if (u==t || a==0) return a;
        int flow=0,f;
        for (int &i=cur[u];i!=-1;i=edges[i].next)
        {
            Edge &e=edges[i];int v=e.to;
            if (d[v]==d[u]+1 && (f=dfs(v,min(a,e.cap-e.flow)))>0)
            {
                e.flow+=f;
                edges[i^1].flow-=f;
                flow+=f;
                a-=f;
            }
            if (a==0) break;
        }
        return flow;
    }
    inline int maxflow()
    {
        int flow=0;
        while (bfs())
        {
            for (int i=0;i<=n+2;i++) cur[i]=head[i];
            flow+=dfs(s,INF);
        }
        return flow;
    }
};
Dinic A;
#define adg A.addedge 



int x[maxn],y[maxn];
int n;


int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&n);
	int S=0,T=2*n+1;
	A.init(2*n+1,20005,S,T);
	for (int i=1;i<=n;i++)
	{
		adg(S,i,1);
		scanf("%d%d",&x[i],&y[i]);
	}
	for (int i=n+1;i<=2*n;i++)
	{
		adg(i,T,1);
		int X,Y;
		scanf("%d%d",&X,&Y);
		for (int j=1;j<=n;j++)
			{
				if (x[j]<X && y[j]<Y)
				adg(j,i,1);
			}
	}
	printf("%d\n",A.maxflow());
	return 0;
}


Measured memory_bytes: 384