#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll M = 1000000007;

template<typename T> class Dinic {
private:
    int V;
    vector<int> level,iter;
    void bfs(int s) {
        fill(level.begin(),level.end(),-1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
        while(!que.empty()){
            int v = que.front();
            que.pop();
            for(auto& e : G[v]){
                if(e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }
    T dfs(int v,int t,T f) {
        if(v==t){
            return f;
        }
        for(int& i = iter[v]; i < (int)G[v].size(); i++){
            edge& e = G[v][i];
            if(e.cap > 0 && level[v] < level[e.to]){
                T d = dfs(e.to,t,min(f,e.cap));
                if(d > 0){
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
 
public:
    struct edge{
        int to;
        T cap;
        int rev;
    };
    vector<vector<edge> > G;
 
    Dinic(int node_size) : V(node_size), level(V), iter(V), G(V){}
    //辺を張る
    void add_edge(int from,int to,T cap) {
        G[from].push_back((edge){to,cap,(int)G[to].size()});
        G[to].push_back((edge){from,(T)0,(int)G[from].size()-1});
    }
    //最大流を計算
    T solve(int s,int t) {
        T flow = 0;
        for(;;){
            bfs(s);
            if(level[t] < 0) return flow;
            fill(iter.begin(),iter.end(),0);
            T f;
            while((f=dfs(s,t,numeric_limits<T>::max())) > 0){
                flow += f;
            }
        }
    }
};

int main(){
    ll n; cin >> n;
    vector<P> R(0), B(0);
    rep(i, 0, n){
        ll a, b;
        cin >> a >> b;
        R.emplace_back(mp(a,b));
    }
    rep(i, 0, n){
        ll a, b;
        cin >> a >> b;
        B.emplace_back(mp(a,b));
    }
    Dinic<int> g(2*n+2);
    rep(i, 1, n+1){
        g.add_edge(0, i, 1);
    }
    rep(i, n+1, 2*n+1){
        g.add_edge(i, 2*n+1, 1);
    }
    rep(i, 1, n+1){
        ll x = R[i-1].fst, y = R[i-1].snd;
        rep(j, n+1, 2*n+1){
            ll w = B[j-n-1].fst, z = B[j-n-1].snd;
            //prt(x); prt(" "); prt(y); prt(" "); prt(w); prt(" "); prtl(z);
            if(x < w&&y < z){
                g.add_edge(i, j, 1);
            }
        }
    }
    prtl(g.solve(0, 2*n+1));
}



Measured memory_bytes: 3696