#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
#define int long long int
#define double long double
using namespace std;
#define INT_MAX 1000000005
#define INF 1000000005
const int MAX_N = 1 << 17;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

signed main()
{
int n;
std::cin>> n;
std::vector<std::vector<int>> red;
std::vector<std::vector<int>> blue;

for(int i = 0; i < n; i++){
    std::vector<int> temp;
    int tx,ty;
    std::cin >> tx >> ty;
    temp.push_back(tx);
    temp.push_back(ty);
    temp.push_back(0);
    red.push_back(temp);
}
for(int i = 0; i < n; i++){
    std::vector<int> temp;
    int tx,ty;
    std::cin >> tx >> ty;
    temp.push_back(tx);
    temp.push_back(ty);
    temp.push_back(0);
    blue.push_back(temp);
}
//std::sort(red.begin(),red.end(),std::greater<int>());
//std::sort(blue.begin(),blue.end(),std::greater<int>());
std::sort(red.begin(), red.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[0] < b[0];});
std::sort(blue.begin(), blue.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[0] < b[0];});
std::stable_sort(red.begin(), red.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[1] < b[1];});
std::stable_sort(blue.begin(), blue.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[1] < b[1];});
int sum = 0;
int ri = 0;
int bi = 0;
std::vector<int> checkr(n + 1,0);
std::vector<int> checkb(n + 1,0);
/*for(int i = 0; i < n; i++){
    std::cout << i << " " << red[i][0] << " " << red[i][1] << " " << blue[i][0] << " " << blue[i][1] << std::endl;
}*/
//int buf = 0;
//while(buf <= 2 * n){
    int fr = 1;
    for(int t = 0; t < n; t++){
        for(int i = 0; i < n; i++){
            if(red[t][0] >= blue[i][0] || red[t][1] >= blue[i][1] || checkb[i] == 1 || checkr[t] == 1){
            } else {
                //checkb[i] = 1;
                //checkr[t] = 1;
                red[t][2]++;
                blue[i][2]++;
            }
        }
    }
//    buf++;
//}
int suma = 0;
int sumb = 0;
int sumc = 0;
std::sort(red.begin(), red.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[2] < b[2];});
std::sort(blue.begin(), blue.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[2] < b[2];});
for(int t = 0; t < n; t++){
    for(int i = 0; i < n; i++){
        if(red[t][0] >= blue[i][0] || red[t][1] >= blue[i][1] || checkb[i] == 1 || checkr[t] == 1){
        } else {
            checkb[i] = 1;
            checkr[t] = 1;
            suma++;
            break;
        }
    }
}
std::vector<int> checkrr(n + 1,0);
std::vector<int> checkbb(n + 1,0);
std::stable_sort(red.begin(), red.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[0] < b[0];});
for(int t = 0; t < n; t++){
    for(int i = 0; i < n; i++){
        if(red[t][0] >= blue[i][0] || red[t][1] >= blue[i][1] || checkbb[i] == 1 || checkrr[t] == 1){
        } else {
            checkbb[i] = 1;
            checkrr[t] = 1;
            sumb++;
            break;
        }
    }
}
std::vector<int> checkrrr(n + 1,0);
std::vector<int> checkbbb(n + 1,0);
std::sort(blue.begin(), blue.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[1] < b[1];});
std::sort(red.begin(), red.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[2] < b[2];});
std::stable_sort(blue.begin(), blue.end(),[](const std::vector<int>& a, const std::vector<int>& b) {return a[1] < b[1];});
for(int t = 0; t < n; t++){
    for(int i = 0; i < n; i++){
        if(red[t][0] >= blue[i][0] || red[t][1] >= blue[i][1] || checkbbb[i] == 1 || checkrrr[t] == 1){
        } else {
            checkbbb[i] = 1;
            checkrrr[t] = 1;
            sumc++;
            break;
        }
    }
}
sum = std::max(std::max(suma,sumb),sumc);
std::cout << sum << std::endl;
return 0;
}

Measured memory_bytes: 384