#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;
const double PI=3.14159265359;

class Edge{
    public:
    int cap,flow,dest;
    bool inGraph;
    Edge *flEdgePair, *resEdgePair;
    Edge(int _dest, int _cap, bool ing, int _flow=0):dest(_dest),inGraph(ing),
    cap(_cap), flow(_flow){}
    
    void addFlow(int fl){
        cap-=fl;
        resEdgePair->cap+=fl;
        if(inGraph) flEdgePair->flow+=fl;
        else flEdgePair->flow-=fl;
    }
};

class Dinic{
    public:
    vector<vector<Edge*>> flow, res;
    vector<int> dists, preds;
    
    int S,n,T;
    Dinic(vector<vector<pair<int,int>>>& net):S(0), n(net.size()), T(n-1){
        flow.resize(n);
        res.resize(n);
        dists.resize(n);
        preds.resize(n);
		fill(preds.begin(), preds.end(),-1);
        
        for(int i=0; i<n; i++){
            for(auto p:net[i]){
                Edge* e1=new Edge(p.first, p.second, true);
                Edge* e2=new Edge(i, 0, false);
                Edge* e3=new Edge(p.first, p.second, true);
                
                e1->flEdgePair=e3;
                e2->flEdgePair=e3;
                e1->resEdgePair=e2;
                e2->resEdgePair=e1;
                flow[i].push_back(e3);
                res[i].push_back(e1);
                res[p.first].push_back(e2);
            }
        }
    }
    bool bfs(){
        fill(dists.begin(), dists.end(),-1);
        queue<int> q;
        q.push(S);
        dists[S]=0;
        while(q.size()){
            int cur=q.front();
            q.pop();
            for(auto e:res[cur]){
                if(e->cap && dists[e->dest]==-1){
                    dists[e->dest]=dists[cur]+1;
                    q.push(e->dest);
                }
            }
        }
        return dists[T]!=-1;
    }
    
    void dfs(){
        vector<int> ep(n);
        vector<bool> dead(n);
        while(!dead[S]){
            //vector<int> preds(n,-1);
            stack<int> st;
            st.push(0);
            while(st.size()){
                int cur=st.top();
                //cout<<cur<<endl;
                if(cur==T) break;
                while(ep[cur]<res[cur].size() && (dead[res[cur][ep[cur]]->dest] ||
                dists[res[cur][ep[cur]]->dest]!=dists[cur]+1 || 
                res[cur][ep[cur]]->cap==0)){
                    ep[cur]++;
                }
                if(ep[cur]==res[cur].size()){
                    dead[cur]=true;
                    st.pop();
                }
                else{
                    preds[res[cur][ep[cur]]->dest]=cur;
                    st.push(res[cur][ep[cur]]->dest);
                }
            }
            if(st.size() && st.top()==T){
                //cout<<st.size()<<endl;
                int flVal=1e9;
                int cur=T;
                while(cur!=S){
                    //cout<<cur<<endl;
                    cur=preds[cur];
                    flVal=min(flVal,res[cur][ep[cur]]->cap);
                }
                cur=T;
                while(cur!=S){
                    cur=preds[cur];
                    res[cur][ep[cur]]->addFlow(flVal);
                }
            }
            else{
                dead[S]=true;
            }
            
        }
        
    }
    
    vector<vector<Edge*>> maxflow(){
        //bfs();
        //dfs();
        while(bfs()){
            dfs();
        }
        return flow;
    }
    
    
};



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    vector<pair<int,int>> a(n), b(n);
    for(auto& p:a){
        int x,y;
        cin>>x>>y;
        p={x,y};
    }
    for(auto& p:b){
        int x,y;
        cin>>x>>y;
        p={x,y};
    }
    
    vector<vector<pair<int,int>>> net(2*n+2);
    for(int i=0; i<n; i++){
        net[0].push_back({i+1,1});
        for(int j=0; j<n; j++){
            if(a[i].first<b[j].first && a[i].second<b[j].second){
                net[i+1].push_back({j+1+n,1});
            }
        }
    }
    for(int i=0; i<n; i++){
        net[n+1+i].push_back({2*n+1,1});
    }
    
    Dinic d(net);
    auto mf=d.maxflow();
    
    int ans=0;
    for(auto e:mf[0]){
        ans+=e->flow;
    }
    cout<<ans;
    
    
    
    
    
   
   
    return 0;
}

Measured memory_bytes: 896