#include <bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

// O(|E||V|^2)
// array(V*V) exists!
struct Dinic_pkg{int V,E,s,t;};
struct Dinicseed{int from,to,cup;};
int Dinic(vector<Dinicseed>& seed, Dinic_pkg pkg);
void Dinic_bfs(vector<Dinicseed>& seed, vector<int>& level, vector<vector<int>>& path, Dinic_pkg pkg);
int Dinic_dfs(vector<vector<int>>& cup, vector<int>& level, vector<vector<int>>& path, Dinic_pkg pkg);

int n,a[100],b[100],c[100],d[100];
vector<Dinicseed> v;
Dinic_pkg pkg;

signed main() {
    cin >> n;
    rep(i,n) {
        cin >> a[i] >> b[i];
        Dinicseed huga{0,i+1,1};
        v.pb(huga);
    }
    rep(i,n) {
        cin >> c[i] >> d[i];
        Dinicseed huga{n+i+1,n*2+1,1};
        v.pb(huga);
    }
    rep(i,n) rep(j,n) if (a[i] < c[j] && b[i] < d[j]) {
        Dinicseed huga{i+1,n+j+1,1};
        v.pb(huga);
    }
    pkg = {n*2+2,(int)v.size(),0,n*2+1};
    cout << Dinic(v,pkg) << endl;
    return 0;
}

int Dinic(vector<Dinicseed>& seed, Dinic_pkg pkg) {
    int V=pkg.V,E=pkg.E,s=pkg.s,t=pkg.t,ans=0;
    vector<vector<int>> cup(V,vector<int>(V,0));
    rep(i,E) cup[seed[i].from][seed[i].to] = seed[i].cup;
    while(1) {
        vector<vector<int>> bfs_path(V),dfs_path(V);
        vector<int> level(V,-1);
        rep(i,E) {
            if (cup[seed[i].from][seed[i].to] > 0) bfs_path[seed[i].from].pb(seed[i].to);
            if (cup[seed[i].to][seed[i].from] > 0 && seed[i].to != s) bfs_path[seed[i].to].pb(seed[i].from);
        }
        Dinic_bfs(seed,level,bfs_path,pkg);
        if (level[t] < 0) return ans;
        rep(i,E) {
            int from = seed[i].from, to = seed[i].to;
            if (level[from] != -1 && level[to] != -1) {
                if (level[from] < level[to] && cup[from][to]) dfs_path[to].pb(from);
                if (level[to] < level[from] && cup[to][from]) dfs_path[from].pb(to);
            }
        }
        ans += Dinic_dfs(cup,level,dfs_path,pkg);
    }
}
void Dinic_bfs(vector<Dinicseed>& seed, vector<int>& level, vector<vector<int>>& path, Dinic_pkg pkg) {
    int s=pkg.s,t=pkg.t;
    queue<int> que;
    que.push(s);
    level[s] = 0;
    while(que.size()) {
        int qf = que.front();
        if (qf == t) {
            que.pop();
            continue;
        }
        rep(i,path[qf].size()) {
            if (level[path[qf][i]] == -1) {
                level[path[qf][i]] = level[qf]+1;
                que.push(path[qf][i]);
            }
        }
        que.pop();
    }
}
int Dinic_dfs(vector<vector<int>>& cup,vector<int>& level, vector<vector<int>>& path, Dinic_pkg pkg) {
    static int V=pkg.V,s=pkg.s,t=pkg.t,now_to = pkg.t;
    static stack<int> st;
    if (now_to == s) {
        int from=s,to,cup_min=INF;
        stack<int> stmp = st;
        while(stmp.size()) {
            to = stmp.top();
            cup_min = min(cup_min,cup[from][to]);
            from = to;
            stmp.pop();
        }
        stmp = st;
        from = s;
        while(stmp.size()) {
            to = stmp.top();
            if (cup_min == cup[from][to]) st = stmp;
            if (from != t) cup[from][to] -= cup_min;
            if (to != t) cup[to][from] += cup_min;
            from = to;
            stmp.pop();
        }
        now_to = st.top();
        st.pop();
        return cup_min;
    }
    st.push(now_to);
    rep(i,path[now_to].size()) {
        int now_from = path[now_to][i];
        if (level[now_from] < level[now_to] && cup[now_from][now_to] > 0) {
            now_to = now_from;
            return Dinic_dfs(cup,level,path,pkg);
        }
    }
    st.pop();
    now_to = st.top();
    st.pop();
    return Dinic_dfs(cup,level,path,pkg);
}

Measured memory_bytes: 768