#include <iostream>
#include <algorithm>
#include <list>

struct Point{
  int x;
  int y;
;}
struct Pair{
  Point red;
  Point blue;
;}

int N;
std::list<Point> reds;
std::list<Point> blues;
std::list<Pair> pairs;
typedef std::list<Point>::iterator ItP;

bool cmpYDescendant(const Point &left, const Point &right) {
    return left.y > right.y;
}
 
bool cmpXAscendant(const Point &left, const Point &right) {
    return left.x < right.x;
}

int main(){
	Point p;
  	std::cin>>N;
  	for(int i=0;i<N;i++){
      std::cin>>p.x>>p.y;
      reds.push_back(p);
    }
  	for(int i=0;i<N;i++){
		std::cin>>p.x>>p.y;
      	blues.push_back(p);
    }
  	reds.sort(cmpYDescendant);
  	blue.sort(cmpXAscendant);
  	ItP it_b = blues.begin();
  	while(it_b != blues.end()) {
        bool found = false;
        ItP it_r = reds.begin();
 
        while(it_r != reds.end()) {
            if ((*it_r).x < (*it_b).x && (*it_r).y < (*it_b).y) {
                Pair p;
 
                found = true;
                p.red = *it_r;
                p.blue = *it_b;
                pairs.push_back(p);
                reds.erase(it_r);
                break;
            }
 
            ++it_r;
        }
 
        ++it_b;
    }
 
    std::cout << pairs.size() << endl;
}
        




