#include "bits/stdc++.h"
using namespace std;
// #define int long long
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define INF 2e18;
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(s) (int)s.size()
#define all(x) x.begin(), x.end()
typedef long double ld;

struct BipartiteMatcher{
    vector<vector<int>> G;
    vector<int> L, R, Viz;
    void init(int n, int m){
        G.clear(), L.clear(), R.clear(), Viz.clear();
        G.resize(n), L.resize(n, -1), R.resize(m, -1), Viz.resize(n, 0);
    }
    void AddEdge(int a, int b){ G[a].push_back(b); }
    bool Match(int node){
        if(Viz[node]) return 0;
        Viz[node] = 1;
        for(auto vec : G[node]){
            if(R[vec] == -1 || Match(R[vec])) {
                L[node] = vec;
                R[vec] = node;
                return 1;
            }
        }
        return 0;
    }
    int Solve(){
        bool ok = 1;
        while(ok){
            ok = 0;
            fill(Viz.begin(), Viz.end(), 0);
            fr(i, 0, L.size() - 1)
                if(L[i] == -1)
                    ok |= Match(i);
        }
        int ret = 0;
        fr(i, 0, L.size() - 1)
            ret += (L[i] != -1);
        return ret;
    }
} bm;

int a[105], b[105], c[105], d[105];


signed main()
{
    //freopen("inp.txt","r",stdin);
   // freopen("out.txt","w",stdout);
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    fr(i, 1, n) {
        cin >> a[i] >> b[i];
    }
    fr(i, 1, n) {
        cin >> c[i] >> d[i];
    }
    BipartiteMatcher bm;
    bm.init(n, n);
    fr(i, 0, n - 1) {
        fr(j, 0, n - 1) {
            if(a[i + 1] < c[j + 1] && b[i + 1] < d[j + 1]) {
                bm.AddEdge(i, j);
            }
        }
    }
    cout << bm.Solve() << endl;
    return 0;
}