#include <iostream>
using namespace std;

class twoNum
{
public:
    int X;
    int Y;
};

void swap(twoNum *kr,twoNum *kl){
    twoNum t=*kr;
    *kr=*kl;
    *kl=t;
}

/*void quick(int l, int r, twoNum *k)
{
    if (r - l > 1)
    {
        int base = k[r].X;
        int dl = l;
        int dr = r-1;
        while (true)
        {
            while (k[dl].X <= base)
            {   
                if (dl >= dr)
                {
                    break;
                }
                dl++;
            }
            while (k[dr].X > base)
            {   
                if (dl >= dr)
                {
                    break;
                }
                dr--;
            }
            if (dl >= dr)
            {
                break;
            }
            swap(&k[dl], &k[dr]);
        }
        swap(&k[dr],&k[r]);
        quick(l, dr, k);
        quick(dr + 1, r, k);
    }else{
        if(k[r].X<k[l].X){
            swap(k[r],k[l]);
        }
    }
}*/

void sort(twoNum *k, int N)
{   int count=0;
    for(int i=0;i<N-1-count;i++){
        for(int j=1;j<N-count;j++){
            if(k[i].X>k[j].X){
                swap(&k[i],&k[j]);
            }
        }
    }
}

int main()
{
    int N;
    cin >> N;
    twoNum red[N], blue[N];
    for (int i = 0; i < N; i++)
    {
        cin >> red[i].X >> red[i].Y;
    }
    for (int i = 0; i < N; i++)
    {
        cin >> blue[i].X >> blue[i].Y;
    }
    sort(blue,N);
    bool isUsed[N]={};
    int count =0;
    int MaxY=-1;
    int Max=0;
    for(int i=0;i<N;i++){
        MaxY=-1;
        for(int j=0;j<N;j++){
            if((blue[i].X<red[j].X)||(blue[i].Y<red[j].Y)){
                continue;
            }
            if(MaxY<red[j].Y){
                MaxY=red[j].Y;
                Max=j;
            }
        }
        if((MaxY!=-1)&&(!isUsed[Max])){
            count++;
            isUsed[Max]=true;
        }
    }
    cout << count <<endl;
    return 0;
}