#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
        out << '(' << p.first << ',' << p.second << ')';
            return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
        in >> p.first >> p.second;
            return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
        for (T &x : v)
                    in >> x;
            return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
        for (const vector<T> &x : v)
                    out << x << '\n';
            return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
        for (const T &x : v)
                    out << x << ' ';
            return out;
}

template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
        for (const T &x : s)
                out << x << ' ';
            return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


ll bfs(ll s, ll t, vi & parent,vv &capacity,vv &adj)
{
    fill(parent.begin(), parent.end(), -1);
    parent[s] = -2;
    queue<ii> q;
    q.push({s, inf});

    while (!q.empty()) 
    {
        ll cur = q.front().first;
        ll flow = q.front().second;
        q.pop();

        for (ll next : adj[cur]) 
        {
            if (parent[next] == -1 && capacity[cur][next]) 
            {
                parent[next] = cur;
                ll new_flow = min(flow, capacity[cur][next]);
                if (next == t)
                    return new_flow;
                q.push({next, new_flow});
            }
        }
    }

    return 0;
}

ll maxflow(ll s, ll t,vv &capacity,vv &adj)
{
    ll n=sz(adj);
    ll flow = 0;
    vi parent(n);
    ll new_flow;

    while (new_flow = bfs(s, t, parent,capacity,adj)) 
    {
        flow += new_flow;
        ll cur = t;
        while (cur != s) 
		{
            ll prev = parent[cur];
            capacity[prev][cur] -= new_flow;
            capacity[cur][prev] += new_flow;
            cur = prev;
        }
    }

    return flow;
}

int main()
{
    fast();
    ll n;
    cin>>n;
    vii x(n),y(n);
    vv capacity(2*n+2,vi(2*n+2,0));
    

    cin>>x>>y;
    vv e(2*n+2,vi());
    for(ll i=0;i<n;i++)
    {
        capacity[0][i+1]=1;
        capacity[i+n+1][2*n+1]=1;
        e[0].pb(i+1);e[i+1].pb(0);
        e[i+n+1].pb(2*n+1);
        e[2*n+1].pb(i+n+1);
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            if(x[i].F<y[j].F && x[i].S<y[j].S)
            {
                e[i+1].pb(n+1+j);e[n+1+j].pb(i+1);
                capacity[i+1][n+1+j]=1;
            }
        }
    }
    
    ll ans=maxflow(0,2*n+1,capacity,e);
    cout<<ans<<nl;
}


Measured memory_bytes: 4064