#include<iostream>
using namespace std;

int main(){
    int n, w, r[205], b[205], ans = 0;

    cin >> n;
    for(int i=0; i<201; ++i) r[i] = b[i] = 201;
    for(int i=0; i<n; ++i) {cin >> w; cin >> r[w];}
    for(int i=0; i<n; ++i) {cin >> w; cin >> b[w];}

    for(int i=1; i<200; ++i){
        if(b[i] != 201){
            int rmaxi = 201;
            for(int k=0; k<i; ++k){
                if(r[k] != 201 && r[k] < b[i]){
                    if(rmaxi == 201) rmaxi = k;
                    if(r[rmaxi] < r[k]){
                        rmaxi = k;
                    }
                }
            }
            if(rmaxi != 201){
                r[rmaxi] = 201;
                ++ans;
            }
        }
    }

    cout << ans << endl;
}
