#include <bits/stdc++.h>
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;
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);
  blues.sort(cmpXAscendant);
  std::list<Point>::iterator it_b = blues.begin();
  while (it_b != blues.end()) {
    bool found = false;
    std::list<Point>::iterator 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;
    }
    if (found) {
      it_b = blues.erase(it_b);
    } else {
      ++it_b;
    }
  }
  std::cout << pairs.size() << std::endl;
}
