#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
#include <complex>
#include <assert.h>
#include <limits.h>
//#include <bits/stdc++.h>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
#define tm tmp

//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
typedef pair<int,ll>pil;
typedef pair<ll,ll> pll;
//const double INF=1e20;
const int INF=0x3f3f3f3f;
//const int INF= 0x7fffffff;
//const ll INF=0x3f3f3f3f3f3f3f3fll;
const ll INFF=0x3f3f3f3f3f3f3fll;
//const ll INFF=1e14+5;
const int MAX=2e2+5;
//const ll MAXN=2e8;
//const int MAX_N=MAX;
//const ll MOD=1e9+7;
const int MOD=1e9+7;
//const long double pi=acos(-1.0);
//const double eps=0.00000001;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
//const long double eps=-1.0;
//clock_t t1 = clock();
//fprintf(stderr, "%ld ms\n", clock() - t1);
void open()
{
    freopen("in2.txt","r",stdin);
    freopen("out2.txt","w",stdout);
}


const int MAXM=6e6+5;//总边数
int head[MAX];//数组形式vector
int nxt[MAXM],val[MAXM];
int match[MAX<<1],check[MAX<<1],prv[MAX<<1];
int que[MAXM];//模拟队列
int st,en,cnt,numL;//numL需要初始化为左侧点数！
inline void add_edge(int u,int v)//加边 只需要加左到右的即可
{
    val[cnt]=v;nxt[cnt]=head[u];head[u]=cnt++;
}
//下标 0——numL-1
int Hungarian()
{
    int ans=0;
    memset(match,-1,sizeof(match));
    memset(check,-1,sizeof(check));
    for(int i=0;i<numL;i++)
    {
        if(match[i]==-1)
        {
            st=en=0;
            que[en++]=i;
            prv[i]=-1;
            bool sta=false;
            while(st!=en&&!sta)
            {
                int u=que[st];
                for(int t=head[u];t!=-1&&!sta;t=nxt[t])
                {
                    int v=val[t];
                    if(check[v]!=i)
                    {
                        check[v]=i;
                        que[en++]=match[v];
                        if(match[v]>=0)
                            prv[match[v]]=u;
                        else
                        {
                            sta=true;
                            int d=u,e=v;
                            while(d!=-1)
                            {
                                int q=match[d];
                                match[d]=e;
                                match[e]=d;
                                d=prv[d];
                                e=q;
                            }
                        }
                    }
                }
                ++st;
            }
            if(match[i]!=-1)++ans;
        }
    }
    return ans;
}
int n;
int a[105],b[105],c[105],d[105];
int main()
{
    scanf("%d",&n);
    memset(head,-1,sizeof(head));
    for(int i=0;i<n;i++)scanf("%d%d",&a[i],&b[i]);
    for(int i=0;i<n;i++)scanf("%d%d",&c[i],&d[i]);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(c[j]>a[i]&&d[j]>b[i])
                add_edge(i,j+n);
        }
    }
    numL=n;
//    printf("???");
    printf("%d\n",Hungarian());
}

/*
6 3
477477

5 100
47477
*/



Measured memory_bytes: 4352