#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int points;
  vector<array<int, 2>> red;
  vector<array<int, 2>> blue;
  cin >> points;
  for (int i = 0; i < points; ++i) {
    int a, b;
    cin >> a >> b;
    red.push_back({a, b});
  }
  for (int i = 0; i < points; ++i) {
    int a, b;
    cin >> a >> b;
    blue.push_back({a, b});
  }
  bool endFlg = true;
  int answer;
  while (endFlg) {
    int min[3] = {2147483647, 0, 0};
    for (auto itrRed = red.begin(); itrRed != red.end(); ++itrRed) {
      vector<int> pairList;
      for (auto itrBlue = blue.begin(); itrBlue != blue.end(); ++itrBlue) {
        if ((*itrRed)[0] < (*itrBlue)[0] && (*itrRed)[1] < (*itrBlue)[1]) {
          pairList.push_back(std::distance(blue.begin(), itrBlue));
        }
      }
      if (pairList.size() < min[0] && pairList.size() > 0) {
        min[0] = pairList.size();
        min[1] = std::distance(red.begin(), itrRed);
        min[2] = pairList[0];
      }
    }
    if (min[0] == 2147483647) {
      break;
    } else {
      red.erase(red.begin() + min[1]);
      blue.erase(blue.begin() + min[2]);
      answer++;
    }
  }
  cout << answer << endl;
  return 0;
}
