#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i).first >> a.at(i).second;
  }
  for (int i = 0; i < n; i++) {
    cin >> b.at(i).first >> b.at(i).second;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int count = 0;
  for (int i = 0; i < n; i++) {
    int j = 0, k = -1, ma = -1;
    while (j < n) {
      if (b.at(i).first <= a.at(j).first && b.at(i).second <= a.at(j).second)
        break;
      if (a.at(j).first < 0) {
        j++;
        continue;
      }
      if (ma <= a.at(j).second) {
        ma = a.at(j).second;
        k = j;
      }
      j++;
    }
    if (k >= 0) {
      a.at(k).first = -1;
      count++;
    }
  }
  cout << count << endl;
}
