    #include "bits/stdc++.h"
     
    using namespace std;
     
    typedef long long LL;
    typedef unsigned long UL;
     
    #define FOR(i,a,b) for(int i=(a);i<(b);++i)
    #define REP(i,n) for(int i=0;i<(n);++i)
     
    int main()
    {
        int n;
        cin >> n;
        
        vector<pair<int, int>> ab(n), cd(n);
        REP(i, n)
        {
            cin >> ab[i].first >> ab[i].second;
        }
        REP(i, n)
        {
            cin >> cd[i].first >> cd[i].second;
        }
     
        sort(ab.begin(), ab.end(), greater<pair<int,int>>);
        sort(cd.begin(), cd.end());
     
        int ans = 0, mj;
        vector<int> used(n, -1);
     
        REP(i, n)
        {
            mj = 2 * n;
            REP(j, n)
            {
                if (ab[i].first < cd[j].first && ab[i].second < cd[j].second && find(used.begin(), used.end(), j) == used.end() && cd[j].second == min(cd[j].second, mj))
                {
                    used[i] = j;
                    mj = cd[j].second;
                }
            }
     
            if (used[i] != -1)
            {
                ++ans;
            }
        }
     
        cout << ans << endl;
     
        return 0;
    }