#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;



int main(){
    int N;
    cin >> N;
    vector<P> r,b;
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        r.push_back(P(a,b));
    }
    sort(r.rbegin(),r.rend());
    for(int i=0;i<N;i++){
        int c,d;
        cin >> c >> d;
        b.push_back(P(d,c));
    }
    sort(b.begin(),b.end());
    int cnt=0;
    for(auto p:r){
        for(auto q=b.begin();q!=b.end();q++){
            if(p.first<q->second&&p.second<q->first){
                b.erase(q);
                cnt++;
                break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}