#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)

int main() {
    int N;
    bool used[101] = {};

    pair<int, int> ab[101];
    pair<int, int> cd[101];
    cin >> N;

    rep(i, N) cin >> ab[i].second >> ab[i].first;
    rep(i, N) cin >> cd[i].first >> cd[i].second;

    sort(ab, ab + N, greater<pair<int, int>>());//yの高い順に赤色をソート
    sort(cd, cd + N);

    int cou = 0;
    rep(i, N) {
        rep(j, N) {
            if (ab[i].second < cd[j].first && //定義域内である
                ab[i].first < cd[j].second &&
                used[j] == false) {

                used[j] = true;
                cou++;
                break;
            }
        }
    }
    cout << cou << endl;
}