#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;
using P3 = std::tuple<int,int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int N;
vector<P3> v;

set<int> s;
priority_queue<int, vector<int>, greater<int> > pq;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> N;

    for(int i=0;i<N;++i){
        int x, y;
        std::cin >> x >> y;

        v.emplace_back(x, y, 0);
    }

    for(int i=0;i<N;++i){
        int x, y;
        std::cin >> x >> y;

        v.emplace_back(x, y, 1);        
    }

    sort(v.begin(), v.end());

    // for(int i=0;i<2*N;++i){
    //     int x, y, c;
    //     tie(x, y, c) = v[i];

    //     std::cout << x << ", " << y << ", " << c << std::endl;
    // }

    int res = 0;
    for(int i=0,j=0;i<2*N;i=j){
        while(j < 2*N && thd(v[j]) == 0){
            s.emplace(-snd(v[j]));
            ++j;
        }

        while(j < 2*N && thd(v[j]) == 1){
            int x = -snd(v[j]);
            auto it = s.lower_bound(x);
            if(it != s.end()){
                ++res;
                s.erase(it);
            }
            
            ++j;
        }
    }

    std::cout << res << std::endl;
}
